Im having problems with the code below, Data isnt being pulled out of the database and onto the form. The database does contain the data but the form remains blank. Im using PHP5
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<h1>Skyward Aviation</h1>
<?php
$DBConnect = @mysqli_connect("server", "user", "pass")
or die("<p>Unable to connect to the database server.</p>"
."<p> Error code " .mysqli_connect_errno()
.":". mysqli_connect_error()) . "</p>";
$DBName = "database1";
@mysqli_select_db($DBConnect, $DBName)
Or die("<p>Unable to select the database.</p>"
. "<p>Error code " . mysqli_errno($DBConnect)
. ":" . mysqli_error()) . "</p>";
$TableName = "user";
$SQLstring ="Select * from $TableName WHERE username='gani'";
$QueryResult = @mysqli_query($DBConnect, $SQLstring)
Or die("<P>Unable to execute the query.</p>"
. "<p>Error code" . mysqli_errno($DBConnect)
. ": " . mysqli_error($DBConnect)) . "</p>";
if (mysqli_num_rows($QueryResult) > 0) {
$ROW = mysqli_fetch_row($QueryResult);
$title = stripslashes($Row[3]);
$age = stripslashes($Row[4]);
$username = stripslashes($Row[5]);
$email = stripslashes($Row[6]);
$address = stripslashes($Row[7]);
$City = stripslashes($Row[8]);
$Zip_postcode = stripslashes($Row[9]);
mysqli_free_result($QueryResult);
}
else
{
$title = "";
$Age = "";
$username = "";
$email = "";
$address = "";
$city = "";
$Zip_postcode = "";
}
mysqli_close($DBConnect);
?>
<h2>Contact Information</h2>
<form action="ContactUpdate.php" method="get">
<table frame="border" rules="cols">
<colgroup width="50%" />
<colgroup width="50%" />
<tr><td align="right" valign="top">
<p>Title<input type="text" name="title"
value="<?= $title ?>" size="36" /></p>
<p>Age<input type="text" name="age"
value="<?= $Age ?>" size="36" /></p>
<p>Username <input type="text" name="username"
value="<?= $username ?>" size="36" /></p></td>
<td align="right" valign="top">
<p>Email <input type="text" name="email"
value="<?= $email ?>" size="40" /></p>
<p>Address <input type="text" name="address" value="<?= $address ?>" size="10" />
City <input type="text" name="city" value="<?= $city ?>" size="2" maxlength="2" />
Zip <input type ="text" name="zip" value="<?= $Zip_postcode ?>" size="10" maxlength="10" /></p>
</td></tr>
</table>
<p><input type="submit" value="Submit" /></p>
</form>
</body>
</html>
I would greatly appreciate any help someone could offer.