Monday, 26 August 2013

trying to display mysql data in an html text field

trying to display mysql data in an html text field

I would like to be able to view and edit information contained within a
table from my web browser however I can't for the life in me get the
current values to pull though to an html text field.
Can anyone shed any light as im quite new to php?
Table name: request_details
Column Names: id, name, email_address
My PHP code is:
<?
$order = "SELECT * FROM request_details WHERE id='$id'";
$result = mysql_query($order);
$row = mysql_fetch_array($result);
?>
HTML Code
<form method="post" action="edit_data.php">
<input type="hidden" name="id" value="<?php echo "$row[id]"?>">
<tr>
<td>Name</td>
<td>
<input type="text" name="name" size="20" value="<?php echo
"$row[name]"?>">
</td>
</tr>
<tr>
<td>Email Address</td>
<td>
<input type="text" name="email_address" size="40" value="<?php
echo "$row[email_address]"?>">
</td>
</tr>
<tr>
<td align="right">
<input type="submit"
name="submit value" value="Edit">
</td>
</tr>
</form>

No comments:

Post a Comment