I have written a simple script to allow a user to search for a record in a mysql database which returns it in a html form. What i’m trying to get the form to do is allow the user to edit the record in the form and update it live. I have the following code in my update.php page;
Code:
<?
$username="t;
$password="";
$database=";
mysql_connect(localhost,$username,$password);
mysql_query("UPDATE gosscustomers SET title = '$ud_title' WHERE id = '$ud_id' ");
mysql_query($query);
mysql_close();
?>
<html>
<style type="text/css">
<!--
.style3 {
font-size: large;
font-weight: bold;
}
-->
</style>
<body>
<table width="1230" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="83" colspan="4" valign="top"><p><strong><br />
<br />
</strong>The following record has been successfully changed in the Goss database:
<br />
<br />
</p></td>
<td width="734"> </td>
</tr>
<tr>
<td width="160" height="20" valign="top"><strong>Title:</strong></td>
<td width="189" valign="top"><? Print $ud_title; ?> </td>
<td width="46" valign="top"><strong>ID:</strong></td>
<td width="101" valign="top"><? Print $ud_id; ?></td>
<td> </td>
</tr>
<tr>
<td height="20" valign="top"><strong>First Name:</strong></td>
<td valign="top"><? Print $ud_first_name; ?></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td height="20" valign="top"><strong>Surname:</strong></td>
<td valign="top"><? Print $ud_surname; ?></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td height="20" valign="top"><strong>Company:</strong></td>
<td valign="top"><? Print $ud_company; ?></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="20" valign="top"><strong>Address Line 1: </strong></td>
<td valign="top"><? Print $ud_address_1; ?></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="20" valign="top"><strong>Address Line 2: </strong></td>
<td valign="top"><? Print $ud_address_2; ?></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="20" valign="top"><strong>Address Line 3: </strong></td>
<td valign="top"><? Print $ud_address_3; ?></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="20" valign="top"><strong>Postcode:</strong></td>
<td valign="top"><? Print $ud_postcode; ?></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="20" valign="top"><strong>Country:</strong></td>
<td valign="top"><? Print $ud_country; ?></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="20" valign="top"><strong>Email Address: </strong></td>
<td valign="top"><? Print $ud_email_address; ?></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td height="83"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</body>
</html>
The code is writng the edit values to this page as when i use Print “$ud_title;” it prints the edited title from the form, but for some reason it’s not writing these values back to the database.
Any ideas???