gwydionwaters Posted December 31, 2008 Share Posted December 31, 2008 one select being a select input type in an html form. i don't know if this should go in a java forum or not.. anyway the title says it all, what i want to do is instead of having <select name="option1"><option value="$var1"></option></select> i want to be able to send $var1 and $var2 as option1 in a way that i can use both as their own variable in the script they are sent to. maybe if i were to send it as "$var1,$var2" as $bundle and then somehow separate the two into their own variables on the other side? i am not sure how to do this, or what to google to learn for that matter Link to comment https://forums.phpfreaks.com/topic/139056-solved-sending-two-values-in-one-select/ Share on other sites More sharing options...
chronister Posted December 31, 2008 Share Posted December 31, 2008 yeah, to do what you want, you will have to put them together with some sort of a string seperator and then use explode() on the processing script to split them up. <select name="option1"><option value="<?php echo $var1.','. $var2; ?>"></option></select> On the processing page.... <?php $splitMe = $_POST['option1']; $vars = explode(',', $splitMe); echo 'var1 = '. $var[0]; echo '<br>'; echo 'var2 = '. $var[1]; ?> Hope that helps. Nate Link to comment https://forums.phpfreaks.com/topic/139056-solved-sending-two-values-in-one-select/#findComment-727287 Share on other sites More sharing options...
gwydionwaters Posted January 2, 2009 Author Share Posted January 2, 2009 thanks that did the trick Link to comment https://forums.phpfreaks.com/topic/139056-solved-sending-two-values-in-one-select/#findComment-727821 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.