i've build a form and insert it's data into custom db by $wpdb.
when i click on submit button, page reloaded and one row add to db but not any thing display in website.
you can see it at: my site link
my insert code is:
function insert_form() {
global $wpdb;
$table_name = $wpdb->prefix . "food_resarved";
$alibaba = $wpdb->insert( $table_name, array('id'=>'','user_id'=> wp_get_current_user()->ID,'name'=> wp_get_current_user()->user_firstname,
'lastname'=> wp_get_current_user()->user_lastname ,'post_title'=> $_POST['post_title'],'food_selected'=> $_POST['food'] ,
'guest_number'=>$_POST['guest_food'],'email'=> wp_get_current_user()->user_email ), array( '%d', '%s', '%s' , '%s' , '%s' , '%s' , '%s', '%s' ) );
if ( !$alibaba ) { $mylink = $wpdb->get_results( "select * from wp_food_resarved where user_id like '".$curent_user."' AND post_title like '".$abcde."' "); foreach ($mylink as $posta){ echo ''; echo ' شما '; echo $posta->food_selected; echo ' سفارش دادهاید '; echo ''; } } else {echo "Die";} }
Aucun commentaire:
Enregistrer un commentaire