Hello,

I have a searchform where i want to be able to search for persons who are
married and display the selected records in a table. That's going o.k.
But if i don't check the checkbox, there has to be a 'zero' value so that
all the records in the database will be returned. What am i doing wrong (or
what am i missing) in the following code to produce such a form?
Thanks in advance,

Joep
------------------------------------------------
<html>
<body>
<?
$db = mysql_connect("localhost", "username", "password");
mysql_select_db("database",$db);

if ($submit)
for($i=0;$i<count($married);$i++)
{
$sql = "SELECT * FROM employees WHERE married = '$married'";
$result = mysql_query($sql);

echo "<table border=1>\n";
echo
"<tr><td>Name</td><td>Adres</td><td>Children</td><td>Income</td></tr>\n";
while ($myrow = mysql_fetch_array($result)) {
printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",
$myrow[Name], $myrow[Adres], $myrow[Children], $myrow[Income]);
}}

?>

<P>
<form method="post" action="<? echo $PHP_SELF?>">
Married? <input type=checkbox name="married" value=y> Yes <br>
<input type="Submit" name="submit" value="Search">
</form>
</body>
</html>