What is wrong with this php code?

Matthew

New member
I know there is probably alot wrong. This text is in a file called index.html. None of the php code works. It won't even echo anything.




<html>
<body>

<form action="index.html" method=POST>
<table border=0 cellspacing=0 cellpadding=2>
<tr><td>
Username: <td><input type=text name=user>
<tr><td>
Password: <td><input type =password name =pass>
<tr><td>
Confirm Password: <td><input type=password name=pass_conf>
<tr><td>
About You: <td><textarea name=info cols="40" rows="5"></textarea>

<input type=submit value="Register">
</form><br/>


<? php
print "hello";
$name=$_POST['user'];
$pass=$_POST['pass'];
$info=$_POST['info'];
$pass_conf=$_POST['pass_conf'];




$connection = mysql_connect("localhost","root","hobo");
$db = mysql_select_db("users");

if($name==false || $pass==false || $pass_conf==false){
echo "Fill in all the fields.";
}
if($pass != $pass_conf){
echo "Passwords do not match.";
}else{

$sql = "INSERT INTO userinfo ('Username','Password','Info') VALUES ($name,$pass, $info)";
mysql_query($sql);
echo "Thank You";
}



?>
</body>
</html>
 
Back
Top