Multi select
Hi there,
I have a multi select box in my contact form which also inserts the form into a database and sends an email. All is functioning perfectly except the multi select as nothing is posted for this field.
I have inserted the following code at line 1:
<?php
if($_SERVER["REQUEST_METHOD"] == "POST") {
foreach($_POST as $key => $val) {
if(is_array($_POST[$key])) $_POST[$key] = implode(", ", $_POST[$key]);
}
}
?>
and have added [] to the name of the multi select.
I can't seem to get it to work and would greatly appreciate someone guiding me through this to find a solution.
The code for the multi select is as follows:
<select name="Product_Group[]" size="10" multiple="multiple" class="formListfield_Medium" id="Product_Group" tabindex="15" style="width:250px; height:150px;">
<option value="" <?php if (!(strcmp("", (isset($_GET["invalid"])?ValidatedField("CONTACTFORMNEW","Product_Group"):"")))) {echo "selected=\"selected\"";} ?>>Please select</option>
<option value="Other" <?php if (!(strcmp("Other", (isset($_GET["invalid"])?ValidatedField("CONTACTFORMNEW","Product_Group"):"")))) {echo "selected=\"selected\"";} ?>>Other</option>
<?php
do {
?>
<option value="<?php echo $row_rsProdCat['Name']?>"<?php if (!(strcmp($row_rsProdCat['Name'], (isset($_GET["invalid"])?ValidatedField("CONTACTFORMNEW","Product_Group"):"")))) {echo "selected=\"selected\"";} ?>><?php echo $row_rsProdCat['Name']?></option>
<?php
} while ($row_rsProdCat = mysql_fetch_assoc($rsProdCat));
$rows = mysql_num_rows($rsProdCat);
if($rows > 0) {
mysql_data_seek($rsProdCat, 0);
$row_rsProdCat = mysql_fetch_assoc($rsProdCat);
}
?>
</select>
Incidentally, the form is a plugin using the latest Framework. Do I need to change the form action as for some reason it is not seeing the thank you page even when I put the full URL
Many thanks