mckinney3 Posted October 29, 2005 Share Posted October 29, 2005 I have inserted a List/Menu field using DW into a form. I have specified LIST and enabled ALLOW MULTIPLE. The action is to a PHP script resident on a GoDaddy hosting site. The form submits fine and I get the email that I have asked for. I get all the fields but for fields that should be returning multiple inputs such as the List/Menu field, I only get back one of the possible selections. If I use the MENU variation , I get back the correct choice. I am trying to figure out if the problem is DW code working with PHP in general or with GoDaddy's scripts or me. here is a snippet of code with logo being the choice that is intially selected. <td><select name="select" size="3" multiple> <option value="logo" selected>logo</option> <option value="decription">description</option> <option value="feedback">feedback</option> <option value="guestbook">guestbook</option> </select></td> Quote Link to comment https://forums.phpfreaks.com/topic/2761-listmenu-field/ Share on other sites More sharing options...
morpheus.100 Posted December 7, 2005 Share Posted December 7, 2005 <td><select name="select" size="3" multiple> <option value="logo" selected="selected">logo</option> <option value="decription">description</option> <option value="feedback">feedback</option> <option value="guestbook">guestbook</option> </select></td> How come you modified the automatically inserted code? Quote Link to comment https://forums.phpfreaks.com/topic/2761-listmenu-field/#findComment-10059 Share on other sites More sharing options...
obsidian Posted December 7, 2005 Share Posted December 7, 2005 [!--quoteo(post=325277:date=Dec 7 2005, 05:53 AM:name=morpheus.100)--][div class=\'quotetop\']QUOTE(morpheus.100 @ Dec 7 2005, 05:53 AM) 325277[/snapback][/div][div class=\'quotemain\'][!--quotec--] <td><select name="select" size="3" multiple> <option value="logo" selected="selected">logo</option> <option value="decription">description</option> <option value="feedback">feedback</option> <option value="guestbook">guestbook</option> </select></td> How come you modified the automatically inserted code? it depends on what version of dreamweaver whether or not "selected" or "selected='selected'" is generated. same thing with checkboxes. if you're using an older version (i believe MX or earlier), it will simply put "checked" as your value, not "checked='checked'". this is due to validation requirements of XHTML. i believe the issue is that to return more than one value through PHP, you need to declare your select box as an array: <?php if (isset($_POST['select'])) { foreach ($_POST['select'] as $value) { echo "$value<br />\n"; } } ?> <form name='test' action='' method='post'> <select name='select[]' multiple='multiple'> <option value="logo" selected='selected'>logo</option> <option value="decription">description</option> <option value="feedback">feedback</option> <option value="guestbook">guestbook</option> </select> <input type='submit' name='submit' value='Submit' /> </form> notice the name of the select field is "select[]" to declare it as an array! try this out and see if it makes sense. Quote Link to comment https://forums.phpfreaks.com/topic/2761-listmenu-field/#findComment-10062 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.