topflight Posted January 25, 2009 Share Posted January 25, 2009 Hi I need some minor assistant I am trying to loop an option form to show all the name in my databse may somebody please give me some advice or examples on how to do this. I know it is very simple but I just don't know where to start at. Thanks in Adnvanced! Link to comment https://forums.phpfreaks.com/topic/142316-solved-looping-option-form/ Share on other sites More sharing options...
redarrow Posted January 25, 2009 Share Posted January 25, 2009 <?php //database connection. $db=mysql_connect("localhost","username","password"); $db_res=mysql_select_db("db_name",$db); //form out off loop echo"<form method='POST' method=' '>"; //select every database field names. $sql="SELECT * FROM what_ever"; $sql_res=mysql_query($sql)or die(mysql_error()); // loop all from select statement while($row=mysql_fetch_assoc($sql_res)){ //echo al the names. echo "<input type='text' name='name' vlaue='{$row["name"]}'>"; // submit each name if need be. button named submit. //echo"<input type='submit' name='submit' value='send'>"; } // submit all the names if need be. button named submit. echo"<input type='submit' name='submit' value='send'>"; ?> Link to comment https://forums.phpfreaks.com/topic/142316-solved-looping-option-form/#findComment-745719 Share on other sites More sharing options...
topflight Posted January 25, 2009 Author Share Posted January 25, 2009 I don't understand that. I would like to put all my information in an option form. <select> <option value"I want to loop here" also I want the information to display here</option> </select> Link to comment https://forums.phpfreaks.com/topic/142316-solved-looping-option-form/#findComment-745723 Share on other sites More sharing options...
redarrow Posted January 25, 2009 Share Posted January 25, 2009 called a select box mate, the other was a text box example. <?php //database connection. $db=mysql_connect("localhost","username","password"); $db_res=mysql_select_db("db_name",$db); //form out off loop echo"<form method='POST' method=' '>"; //select every database field names. $sql="SELECT * FROM what_ever"; $sql_res=mysql_query($sql)or die(mysql_error()); //start select box. <select name='name'> // loop all from select statement while($row=mysql_fetch_assoc($sql_res)){ //echo al the names. echo "<option vlaue='{$row["name"]}'>{$row["name"]}<option>"; } // end select . <select> // submit names if need be. button named submit. echo"<input type='submit' name='submit' value='send'>"; ?> Link to comment https://forums.phpfreaks.com/topic/142316-solved-looping-option-form/#findComment-745725 Share on other sites More sharing options...
topflight Posted January 25, 2009 Author Share Posted January 25, 2009 thanks Link to comment https://forums.phpfreaks.com/topic/142316-solved-looping-option-form/#findComment-745726 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.