The venture that I am engaged on have a consumer login part. As soon as the consumer logged in, they need to be capable of see a listing of orders that they made up to now that are saved within the database. The checklist view is completed by a foreach operate. On this case, the consumer should be capable of rebook any of these previous order by one click on and it ought to ship the identical information again to the database as a brand new row or duplicate the identical row with a brand new id. My code appears like this:
<kind technique="put up" motion="">
foreach ( $row as $row ){ ?>
<div> Earlier Journey from:
<?php echo $row-> your_departing .' to : '.$row-> your_destination; ?>
<?php $depart = $row-> your_departing;
$dest = $row-> your_destination;
?>
<button sort="submit" identify="rebook" class="signupbtn">REBOOK</button>
</div>
<?php } ?>
</kind>
if ( isset( $_POST["rebook"] ) != "" ) {
$desk = $wpdb->prefix."Savedata";
$wpdb->insert(
$desk,
array(
'your_destination' => $dest,
'your_departing' => $depart
)
);
}
?>
I wrote this code to insert the information as a brand new row.
Do I miss one thing within the code? Can anybody counsel a simple method to get this completed? Any helps could be nice. Thanks