Search the Community
Showing results for tags 'php msql html'.
-
Hello, I working on my code to populate a text field from a column of data in a mysql database and i was successful. -- I don't know if this is the best code to do so. Check it out!! <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <meta name="generator" content="Adobe GoLive" /> <title>Test site</title> </head> <body> <form action="index.php" method="post" name="sampleDetail" target="_self" class="container" AUTOCOMPLETE="off"> <label for="sampleID">Gene 1: </label> <input type="text" name='sampleID' id='sampleID' list="samp"> <br><br> <datalist id="samp"> <?php $connect = mysql_connect("localhost", "root", ""); mysql_select_db("csv_db"); $query = mysql_query("SELECT * FROM `gene_name` ORDER BY `gene_name`.`COL 2` ASC LIMIT 2, 6970"); WHILE ($rows = mysql_fetch_array($query)): $Column_2 = $rows['COL 2']; echo "<option value=$Column_2>$Column_2</option> <br>"; endwhile; ?> </datalist> <label for="sampleID">Gene 2: </label> <input type="text" name='sampleID' id='sampleID' list="samp"> <br><br> <datalist id="samp"> <?php $connect = mysql_connect("localhost", "root", ""); mysql_select_db("csv_db"); $query = mysql_query("SELECT * FROM `gene_name` ORDER BY `gene_name`.`COL 2` ASC LIMIT 2, 6960 "); WHILE ($rows = mysql_fetch_array($query)): $Column_2 = $rows['COL 2']; echo "<option value=$Column_2>$Column_2</option> <br>"; endwhile; ?> </datalist> <input type="button" value="Submit"> </form> </body> </html> Do have any suggestions? I also want to make sure i can type in the same gene with different. This is how it would look in the row: c15of1v | B10of1d | R12of1g -- All three names are listed in the same row. I want to be able to type in either of those names and get the same gene. Is that possible?