EchoFool Posted June 1, 2008 Share Posted June 1, 2008 I need some one help here, I am trying to make a select box with types of options. The idea is firstly it loads up the items from the database into the list and below the items it has houses list (i do this using 2 while loops one after another). Now in the value of the select box I have the ID of the house or item, as shown below: <?php $Get = mysql_query("SELECT ItemID,Name FROM item ORDER BY ItemID ASC") Or die(mysql_error()); While($row = mysql_fetch_assoc($Get)){ $ItemID = $row['ItemID']; $Name = $row['Name']; ?> <option value="<?=$ItemID?>"><?=$Name?> - Item</option> ?> } ?> // REPEAT for house table ?> But I need to also distinguish what type the option value is, weather it is a ItemID or a HouseID. So that I can do validatoin checks in the process page. But it be illogical to query both houses table and item table if I don't know if I am carrying a House ID or a ItemID first. i need some way of adding a "Type" to the ID value. Quote Link to comment https://forums.phpfreaks.com/topic/108243-help-adding-second-id-to-select-box/ Share on other sites More sharing options...
hansford Posted June 1, 2008 Share Posted June 1, 2008 i'm not sure what the select boxes do, but there's probably a post method involved since they'd be attached to a form. When a user clicks a 'submit' button the $_POST variables will hold all the info from the select boxes. If you're wanting to know which form was submitted then you can just ad a value to the submit button. <form name='form1' method='post' action='processpage.php'> <input type='submit' name='itemtable' /> </form> then on the process page we do if(isset($_POST['itemtable'])){ } we now know which form was submitted. hope this helps. Quote Link to comment https://forums.phpfreaks.com/topic/108243-help-adding-second-id-to-select-box/#findComment-554929 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.