hi there,
im new to all this stuff, so im guessing this is quite easy to fix.
i trying to get php to create a new user in a form in myphpadmin, however it seems to only accept numbers, does anyone know why?
here is my code for php:
<?php //begin
$host = localhost;
$dbuser = user;
$dbpass = pw;
$dbname = dbname;
$connection = mysql_connect($host, $dbuser, $dbpass);
$db = mysql_select_db($dbname, $connection);
//grab data from form
$name = $_POST[username];
$pass = $_POST[password];
$pass_conf = $_POST[pass_conf];
$email = $_POST[email];
if($name == false || $pass == false || $pass_conf == false || $email == false){
echo "Please fill in all required fields.";
};
if($pass != $pass_conf){
echo "Passwords do not match";
}else{
$connection = mysql_connect($host, $dbuser, $dbpass);
$db = mysql_select_db($dbname, $connection);
$sql = "INSERT INTO user (username,password,email) VALUES ($name, $pass, $email)";
$result = mysql_query($sql);
echo "Thank you for your registration to YOURSITENAME.com";
};
?>
and here is my form:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form name=reg action=do_reg.php method=post>
Username: <input name=username type=text /><br />
Password: <input type=password name=password /><br />
Confirm: <input type=password name=pass_conf /><br />
Email: <input type="text" name=email /><br />
<input type="submit" value='Register' />
</form>
</body>
</html>
any help would be great!