close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Multi select

Thread began 3/29/2013 4:53 am by chris250441 | Last modified 3/29/2013 2:29 pm by chris250441 | 627 views | 7 replies

chris250441

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

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...