html forms and php populate from Mysql -
html forms and php populate from Mysql -
i have created html form populated mysql query. info has spaces in it.
eg "bob site", "sarah home"
when form created in browser this: bob site sarah home
instead of bob site sarah home.
i know need format info can't find examples. form code below.
<?php include("includes/header.php"); ?> <?php $site = mysql_query("select distinct `site_name` sept_billing"); ?> <html> <body> <h2>create new install</h2> <form method="post" action="actions/newmachine_action.php"> <table border = '0'> <tr> <td><b>site name:</b></td> <td><input id="site" type="text" name="site" size="40" list="sites" value = 'choose site name' /> <datalist id="sites"> <?php while ($row = mysql_fetch_array($site)) { echo "<option value=".$row[0].">"; } ?> </datalist></td> </tr> </table> <input type="submit" value="create" /> </form> </body> </html> <?php include("includes/footer.php"); ?>
please alter , allow me know if works
echo "<option value=".$row[0].">";
to
echo "<option value='".$row[0]."'>";
php html mysql
Comments
Post a Comment