hi i need some help someone please. i tried so many combinations of code with but not getting anywhere. I need a user to enter an id through a form, then the code should retrieve certain fields of the table and display them in a table. here is the code.
<form method="POST" action="actioned.php">
<table>
<col span="1" align="right">
<tr>
<td><font color="blue">Membership No:</font></td>
<td><input type="text" name="id" id="id" size=50></td>
</tr>
<tr>
<td><input type="submit" value="Submit"></td>
</tr>
</table>
</form>
<?php
// Connects to your Database
$dbhost = "localhost"; // variable holding host information
$dbname = "sportscentre"; // variable holding the name of the database
$dbuser = "*****"; // variable holding the username of the person using database account
$dbpass = "*****"; // variable holding password of the person using database account
$connection = mysql_connect($dbhost, $dbuser, $dbpass)or die("Cannot connect");
$connection = mysql_select_db($dbname)or die("cannot select DB");
$id = $_POST['id'];
$data = mysql_query("SELECT title, first_name, surname, addr_line_1, addr_line_2, city, postcode, tel_number, mob_number, email FROM members where id = '$_post[id]'")or die(mysql_error());
$result = mysql_query($data)or die ("Query failed: " . mysql_error());
Print "<table border cellpadding=3>";
while($info = mysql_fetch_array( $data ))
{
Print "<tr>";
Print "<th>Title:</th><td>".$info['title'] . "</td></tr>";
Print "<tr>";
Print "<th>First Name:</th> <td>".$info['first_name'] . " </td></tr>";
Print "<tr>";
Print "<th>Surname:</th> <td>".$info['surname'] . " </td></tr>";
Print "<tr>";
Print "<th>Address Line 1:</th> <td>".$info['addr_line_1'] . " </td></tr>";
Print "<tr>";
Print "<th>Address Line 2:</th> <td>".$info['addr_line_1'] . " </td></tr>";
Print "<tr>";
Print "<th>City:</th> <td>".$info['city'] . " </td></tr>";
Print "<tr>";
Print "<th>Postcode:</th> <td>".$info['postcode'] . " </td></tr>";
Print "<tr>";
Print "<th>Tel Number:</th> <td>".$info['tel_number'] . " </td></tr>";
Print "<tr>";
Print "<th>Mob Number:</th> <td>".$info['mob_number'] . " </td></tr>";
Print "<tr>";
Print "<th>Email:</th> <td>".$info['email'] . " </td></tr>";
//Print "<tr>";
//Print "<th>Username:</th> <td>".$info['username'] . " </td></tr>";
//Print "<tr>";
//Print "<th>Password:</th> <td>".$info['password'] . " </td></tr>";
}
Print "</table>";
?>