Hi everybody,
I'm currently working on opening a site and i wanted to implent a registration system. I already installed Apache+mySQL+PHP (4.3.3) on my computer to text my site. After looking around for a while i started to build it but im stuck ... i can't figure out wqhat the prob on my code but i just can't take something in a form and add it to my database ... (sumthing) VALUES ('$sumthing') ...
here is my code :
<html>
<head>
<title>Register</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
if ($submit) {
// process form
$db = mysql_connect("localhost", "root", "scrabbles");
mysql_select_db("qccs", $db);
$sql = "INSERT INTO users (firstname, lastname, location, username) VALUES('$firstname', '$lastname', '$location', '$username)";
$result = mysql_query($sql);
echo "Thank you! Information entered.\n";
} else{
// display form
?>
<form method="post" action="<?php echo $PHP_SELF ?>">
First name:<input type="Text" name="firstname"><br>
Last name:<input type="Text" name="lastname"><br>
Address:<input type="Text" name="location"><br>
Username:<input type="Text" name="username"><br>
<input type="Submit" name="submit" value="Enter information">
</form>
<?php
}
?>
</body>
</html>
Could someone help me figure out whats the prob plz?
Thanks,
~Francky683~