I would like to add to my web form a section where the user can select yes or no. The reason for this is that if they select yes then his / her details will be displayed using the code below. What i need to know is how i create the if statement on the following code?
i understand that it would work in the following way but i'm not sure how to code it in.
if the user selects Yes then show all results
else
do not display the users details
<?php
$con = mysql_connect("localhost","db_username","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("db_name", $con);
$result = mysql_query("SELECT * FROM members");
echo "<table border='1'>
<tr>
<th>Email Address</th>
<th>Title</th>
<th>First Name</th>
<th>Last Name</th>
<th>Address</th>
<th>Mobile</th>
<th>Tennis Number</th>
<th>LTA Number</th>
<th>ITF ITN Number</th>
<th>Age</th>
<th>Club</th>
</tr>";
while($row = mysql_fetch_array($result)) {
echo "<tr>";
echo "<td><a href='mailto:{$row['username']}'>{$row['username']}</a></td>";
echo "<td>" . $row['title'] . "</td>";
echo "<td>" . $row['showdetails'] . "</td>";
echo "<td>" . $row['firstname'] . "</td>";
echo "<td>" . $row['lastname'] . "</td>";
echo "<td>" . $row['address'] . "</td>";
echo "<td>" . $row['mobile'] . "</td>";
echo "<td>" . $row['tennis_number'] . "</td>";
echo "<td>" . $row['lta_number'] . "</td>";
echo "<td>" . $row['itf_itn_number'] . "</td>";
echo "<td>" . $row['age'] . "</td>";
echo "<td>" . $row['club'] . "</td>";
echo "</tr>";
} echo "</table>";
mysql_close($con);
?>
Thanks
Hud


Sign In
Create Account


Back to top









