I have made a HTML-form where a user can make some indications into text-fields which should be send to a database like a member or a client. But he only should be allowed to do this once.
So I have to compare his statements with the database, are they already existing?
So my Script is like the following:
<head>
<title></title>
<?
mysql_connect("localhost","root","");
mysql_select_db("member");
if($submit)
{
$result = mysql_query("SELECT ID, name, email FROM kennung WHERE name='$name'");
while($row = @mysql_fetch_array($result))
{
if ($name == $row["name"])
{
echo $row["ID"];
echo " - ";
echo $row["name"];
echo "<br>\n";
echo "Already existing!<br>\n";
}
}
}
?>
</head>
<body>
<form action="<? $PHP_SELF ?>" method="post">
<table>
<tr><td>Name:</td>
<td><input type="Text" name="name" value="<? $name ?>" size="30" ></td></tr>
<tr><td>Email:</td><td><input type="Text" name="email" value="<? $email ?>" size="50" ></td></tr>
<tr><td> </td>
<td><input type="Submit" name="submit" value="Send"></td></tr>
</table>
</form>
</body>
It doesn't work. I don't get a warning or an error message - I get nothing.
Could you help me - find my mistake please.
Animaus