I have an array which pulls in all form values in as
Code: Select all
foreach ($_POST as $key => $value) {
$value = stripslashes(strip_tags($value));
if (empty($value)) {
exit("<p>Empty fields are not allowed. Please go <a href=\"javascript: history.go(-1)\">Back</a> and fill in the form properly.</p>");
}
//if multiple select count and join option values
if (count($_POST[$key]) >1) {
$_POST[$key] = join(", ", $value);
}
else {$_POST[$key] = stripslashes(strip_tags($value));}
}Code: Select all
<select name="mselect[]" multiple="multiple"><option>Option 1<option>Option 2</select>I'm very new to arrays and I cannot figure out how to get a single selected option to return in the multiple select fields. Any ideas?
pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: