Tim Mousel
Fri 18th Oct '02, 3:18am
Hi,
I've got a form with a Select Menu that allows multiple selections:
<select name="exp_mm[]" multiple>
<option value="Music"<?php if ($exp_mm == "Music") { echo " SELECTED"; } ?>>Music/Comp</option>
<option value="Photo"<?php if ($exp_mm == "Photo") { echo " SELECTED"; } ?>>Photography</option>
The user enters selects their data and the info gets inserted into the database. I'm assuming this is the way to store their data:
$exp_mm = addslashes(serialize($_POST['exp_mm']));
My question is:
When the user comes back to the form page after logging in, how do I display their multiple selections for 'exp_mm'?
Here's what I have so far:
while ($row = mysql_fetch_array($sql_result)) {
$exp_mm = $row["exp_mm"];
$exp_supp = $row["exp_supp"];
}
$exp_mm = stripslashes($exp_mm);
$exp_mm = unserialize($exp_mm);
I'm still not able to have the users stored values displayed on the Select Menu.
I tried this but it didn't work:
[php]
<select name="exp_mm[]" multiple>
<option value="Music"<?php if ($exp_mm[] == "Music") { echo " SELECTED"; } ?>>Music/Comp</option>
<option value="Photo"<?php if ($exp_mm[] == "Photo") { echo " SELECTED"; } ?>>Photography</option>
Any ideas?
Thanks,
Tim
I've got a form with a Select Menu that allows multiple selections:
<select name="exp_mm[]" multiple>
<option value="Music"<?php if ($exp_mm == "Music") { echo " SELECTED"; } ?>>Music/Comp</option>
<option value="Photo"<?php if ($exp_mm == "Photo") { echo " SELECTED"; } ?>>Photography</option>
The user enters selects their data and the info gets inserted into the database. I'm assuming this is the way to store their data:
$exp_mm = addslashes(serialize($_POST['exp_mm']));
My question is:
When the user comes back to the form page after logging in, how do I display their multiple selections for 'exp_mm'?
Here's what I have so far:
while ($row = mysql_fetch_array($sql_result)) {
$exp_mm = $row["exp_mm"];
$exp_supp = $row["exp_supp"];
}
$exp_mm = stripslashes($exp_mm);
$exp_mm = unserialize($exp_mm);
I'm still not able to have the users stored values displayed on the Select Menu.
I tried this but it didn't work:
[php]
<select name="exp_mm[]" multiple>
<option value="Music"<?php if ($exp_mm[] == "Music") { echo " SELECTED"; } ?>>Music/Comp</option>
<option value="Photo"<?php if ($exp_mm[] == "Photo") { echo " SELECTED"; } ?>>Photography</option>
Any ideas?
Thanks,
Tim