Hello everyone,
This is my first post here in phpbuilder,
I have a problem sending information from a form to mysql.
the file is called register.php
here is the code
<head>
<title>Register User</title>
</head>
<body>
<form action="<?php echo $PHP_SELF ?>" method="post">
<%
mysq_connect(localhost , root);
mysql_select_db("register");
$query = "INSERT INTO users (name , email) VALUES ('$name' , '$email')";
$result = mysql_query($query);
%>
<table border="0" width="17%" height="89">
<tr>
<td width="44%" height="25"><font face="Camion"><font size="2">Name:</font><font size="2"><input type="text" name="name" size="20"></font></font></td>
</tr>
<tr>
<td width="44%" height="25"><font size="2">Email: <input type="text" name="email" size="20"></font></td>
</tr>
<tr>
<td width="44%" height="27">
<p><a href="check.htm"><input type="submit" value="Submit" name="submit"></a><input type="reset" value="Reset" name="B2"></p>
<p>
</p>
</form>
</td>
</tr>
</table>
<?
mysql_connect(localhost , root);
mysql_select_db("register");
$query2 = "select * from users order by id DESC";
$result2 = mysql_query($query2);
$rows = mysql_fetch_array($result2);
$name = $rows['name'];
print "Latest registred user:\n";
print "$name";
?>
</body>
</html>
Can someone tell me why the form doesnt send the variables in the mysql database?
Thanks for your help.
Sky