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 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 ? 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> 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')"); ?> 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! 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 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. 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
Archived
This topic is now archived and is closed to further replies.