PHP Experts Please help

I have posted on many forums yet no one has been able to fix this problem I have, if anyone could write me a tutorial or fix my exact code I will eternally great full. No one has been able to work this out.

I have options in the ‘fromVenue’ multi selection box which the user can selected an add to the ‘toVenue’ multi selection box. Once the user hits submit the selected options get sent the a mysql table to the field ‘venue’, where there stored as an array.

Now when you refresh the page that has the multi slection page on the selections that were made in the ‘toVenue’ box have gone. Here lies my problem how do I keep them in that multi selection list, what is wrong with my code?

Below is my code

My PHP Code is


// ------- PARSING PERSONAL TRAINER DETAILS VENUE ---------
if ($_POST[‘parse_var’] == “toVenue”){

$venue = $_POST['venue'];
if (is_array($_POST['venue'])) {

$venue = explode("\n", $_POST[‘venue’]);
} else {
$venue = $_POST[‘venue’];
}

 // Update the database data now here for all fields posted in the form
 $sqlUpdate = mysql_query("UPDATE ptdata SET venue='$venue' WHERE id='$id' LIMIT 1");
 if ($sqlUpdate){
        $success_msg = '<img src="images/Form/round_success.png" width="20" height="20" alt="Success" />Your venue information has been updated successfully';
 } else {
	    $error_msg = '<img src="images/Form/round_error.png" width="20" height="20" alt="Failure" /> ERROR: Problems arose during the information exchange, please try again later</font>';
 }

}
// ------- END PARSING PERSONAL TRAINER DETAILS VENUE ---------
//------------------------------------------------------------------------------------------------------------------------

<?php $dbString = ''; // To be pulled from Database $toVenue = explode(',', $dbString); $venue = Array('Canada','Finland','France','Germany','Mexico','Norway','Spain','United Kingdom','United States'); $message = 'Please Select Desired Countries'; if($_SERVER['REQUEST_METHOD'] == 'POST'){ $toVenue = (count($_POST['toVenue']) > 0)? $_POST['toVenue'] : Array(); $newDbString = implode(',', $toVenue); // Store in Database; $message = 'Selected Countries: ' . implode(', ', $toVenue); // Just a way to show selection for you to verify. } $fromVenue = array_diff($venue, $toVenue); ?>

My HTML ***********************

<?php foreach($fromVenue as $itm){ echo "\t" . '' . $itm . '' . PHP_EOL; } ?> <?php foreach($toVenue as $itm){ echo "\t" . '' . $itm . '' . PHP_EOL; } ?>
Sponsor our Newsletter | Privacy Policy | Terms of Service