komquat Posted November 13, 2006 Share Posted November 13, 2006 I would like to know if you can bring multiple variable over from a drop down menu. If you can, please point me in the right direction. Thank you in advance Link to comment https://forums.phpfreaks.com/topic/27093-2-variable-from-a-command/ Share on other sites More sharing options...
joshi_v Posted November 13, 2006 Share Posted November 13, 2006 As much as i know..you can't pass 2 variables from one option.If you like you can attach two values by using a separator. After posting you can seperate those fileds and use it. ;) Link to comment https://forums.phpfreaks.com/topic/27093-2-variable-from-a-command/#findComment-123878 Share on other sites More sharing options...
komquat Posted November 13, 2006 Author Share Posted November 13, 2006 [quote author=joshi_v link=topic=114810.msg467236#msg467236 date=1163421787]As much as i know..you can't pass 2 variables from one option.If you like you can attach two values by using a separator. After posting you can seperate those fileds and use it. ;)[/quote]This would work, could I get a bit of help with this. I can display multiple, but not sure how to use a separator for the variable.Thanks Link to comment https://forums.phpfreaks.com/topic/27093-2-variable-from-a-command/#findComment-124025 Share on other sites More sharing options...
obsidian Posted November 13, 2006 Share Posted November 13, 2006 Well, a multiple select box would work:[code]<?php// Handle the submission$mySelect = $_POST['mySelect']; // contains an array of selections// display your select boxecho "<select name=\"mySelect[]\" multiple=\"multiple\">\n";// list your options hereecho "</select>\n";?>[/code]As far as passing two values, I think what is being suggested is simply choosing a delimiter to use within your value of your options:[code]<?php// retrieve option values$mySelect = explode('|', $_POST['mySelect']);echo $mySelect[0]; // "value1"echo $mySelect[1]; // "value2"// set up your optionsecho "<option value=\"value1|value2\">Text 1</option>\n";?>[/code]Hope this helps some Link to comment https://forums.phpfreaks.com/topic/27093-2-variable-from-a-command/#findComment-124032 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.