ionnnnutz Posted April 11, 2007 Share Posted April 11, 2007 i have a table in wich i've inserted city's name.then i have an registration form in wich i want to display an dropdown list with the cities from the table, and if one city is selected to be automaticly added in the second table. how can i do that? thanks Quote Link to comment https://forums.phpfreaks.com/topic/46577-solved-insert-from-an-drop-down-list/ Share on other sites More sharing options...
MadTechie Posted April 11, 2007 Share Posted April 11, 2007 using insert... what code do you have ? Quote Link to comment https://forums.phpfreaks.com/topic/46577-solved-insert-from-an-drop-down-list/#findComment-226752 Share on other sites More sharing options...
ionnnnutz Posted April 11, 2007 Author Share Posted April 11, 2007 <form id="form1" name="form1" method="get" action="<? echo $PHP_SELF; ?> "> <select name="select"> <?php $list=mysql_query("select * from domenii_comp"); while($row_list=mysql_fetch_assoc($list)){ ?> <option value="<? echo $row_list['id']; ?>" <? if($row_list['comp_domeniu']==$select){ echo "selected"; } ?>> <? echo $row_list['domeniu']; ?></option> <?php } ?> </select> <input type="submit" name="Submit" value="adauga!" class="sbtn"/> </form> Quote Link to comment https://forums.phpfreaks.com/topic/46577-solved-insert-from-an-drop-down-list/#findComment-226754 Share on other sites More sharing options...
MadTechie Posted April 11, 2007 Share Posted April 11, 2007 you need to use something like <?php mysql_query("INSERT INTO secondtable ($_GET['select']) VALUES ('field')"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/46577-solved-insert-from-an-drop-down-list/#findComment-226758 Share on other sites More sharing options...
ionnnnutz Posted April 11, 2007 Author Share Posted April 11, 2007 thanks that worked! Quote Link to comment https://forums.phpfreaks.com/topic/46577-solved-insert-from-an-drop-down-list/#findComment-226780 Share on other sites More sharing options...
MadTechie Posted April 11, 2007 Share Posted April 11, 2007 Cool Oh Please Click Solved Quote Link to comment https://forums.phpfreaks.com/topic/46577-solved-insert-from-an-drop-down-list/#findComment-226810 Share on other sites More sharing options...
soycharliente Posted April 11, 2007 Share Posted April 11, 2007 It's at the very bottom of the thread on the left. Quote Link to comment https://forums.phpfreaks.com/topic/46577-solved-insert-from-an-drop-down-list/#findComment-226828 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.