Urgent help needed. i am a newbie, and starting to have a headache with this problem,
i am using form to enter firstname so that all the details of that person can be pulled.
where am i doing it wrong?
its showing me the headings of firstname, lastname, and age but no data in it. when data is actually available in database.
databasename=testdb
table name = persons1
please check both of my files below.
1) Pullform.html
<html>
<body>
<form action="get1.php" method="post">
<strong>last:</strong>
<input type="text" name="Firstname" />
<input type="submit" name="submit" value="Check employee" />
</form>
</body>
</html>
2) get1.php
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("testdb", $con);
// by just adding ORDER By, i could fetch info in alphabetical order.
$sql = ("SELECT * FROM persons1 WHERE Firstname='$Firstname'");
$result = mysql_query($sql);
echo "<table border='1'>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row . "</td>";
echo "<td>" . $row . "</td>";
echo "<td>" . $row . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>