gple Posted October 2, 2007 Share Posted October 2, 2007 how do I pass two values (cat_id and Id1) else if ($action=="sub_cat") { $result=mysql_query("SELECT * FROM subcat, type where subcat.cat_id=type.id"); $num=mysql_numrows($result); echo "<form action=add_prod.php?action=change_cat&id=".$id."&var=".$var." method=post enctype=multipart/form-data>"; echo "Category: <select name=price id=price>"; echo "<option selected>--Change--</option>"; for($j=0;$j<$num;$j++) { $scat=mysql_result($result,$j,"subcat"); $cat=mysql_result($result,$j,"type"); $cat_id=mysql_result($result,$j,"cat_id"); $id1=mysql_result($result,$j,"id"); echo "<option value=".$id1.">".$cat."-".$scat."</option>"; } echo "<input type=submit name=submit value=Change Price></form>"; Link to comment https://forums.phpfreaks.com/topic/71554-drop-down/ Share on other sites More sharing options...
MmmVomit Posted October 2, 2007 Share Posted October 2, 2007 In the select tag, you want to use the multiple attribute. http://www.w3schools.com/tags/tag_select.asp Link to comment https://forums.phpfreaks.com/topic/71554-drop-down/#findComment-360276 Share on other sites More sharing options...
gple Posted October 2, 2007 Author Share Posted October 2, 2007 But I want to select 1 selection from the drop down and pass two values. I dont want to choose two selections. Link to comment https://forums.phpfreaks.com/topic/71554-drop-down/#findComment-360294 Share on other sites More sharing options...
MmmVomit Posted October 2, 2007 Share Posted October 2, 2007 You could separate the two values by a comma in the value attribute and use explode() to parse it. It's not very elegant, but it will work. Link to comment https://forums.phpfreaks.com/topic/71554-drop-down/#findComment-360296 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.