Populate part of an HTML form with data from php database -
i want create html form connects table have in database in phpmyadmin. have 3 columns: name, decision, time - along submit button. want pull name phpmyadmin table , populate in form , have them select decision drop down menu, , time auto update time when hit submit. can figure out how have drop down menu, not prepopulate name field or auto update time field. if can part of great. have attached script have here:
<html> <head> <title>untitled document</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> </head> <body> <table> <tr> <td align="center">linker tracker</td> </tr> <tr> <td> <table border="1"> <?php include "db.inc.php";//database connection $result = mysqli_query("select * tester"); while ($row=mysqli_fetch_array($result))?> <form action="edit_data.php" method="post"> <td><tr><input type="text" value="$row[name]"></tr></td> <td><tr><select name="pulldown" name="decision"/> <option value=" ">unworked</option> <option value="yes">yes</option> <option value="no">no</option> <option value="maybe">maybe</option?> </tr></td> <td><tr><input type="text" name="$row[time]"></tr></td> <input type="submit" name=<a href=\"edit_data.php"></a> </form> </table></body></html>
rewrite table as
<table border="1"> <?php include "db.inc.php";//database connection returns $dblink connection. $result = mysqli_query($dblink, "select * tester"); while ($row=mysqli_fetch_array($result))?> <form action="edit_data.php" method="post"> <td><tr><input type="text" value="<?php echo $row['name']; ?>"></tr></td> <td><tr><select name="pulldown" name="decision"/> <option value=" ">unworked</option> <option value="yes">yes</option> <option value="no">no</option> <option value="maybe">maybe</option?> </tr></td> <td><tr><input type="text" value="<?php echo $row['time']; ?>"></tr></td> <input type="submit" name="submit"></a> </form> </table>
specifying value value="$row[name]"
wont tell compiler php code. treats normal html.
thus have specify value inside php code blocks (<?php... ?>
);
Comments
Post a Comment