Hi I m trying to play around with some code to get a grasp of how to insert a cookie so the browser can identify a user after sign up. However in my attempt I was met by the above mentioned error.
Could someone kindly tell me what I might not be doing right ?PHP Code:$name="";
$email="";
$msg_to_user="";
if ($_POST['name']!=""){
include_once "connect_to_mysql.php";
$name= $_POST['name'];
$email= $_POST['email'];
$sql = mysql_query("SELECT*FROM users where email ='$email'");
$numsRows = mysql_num_rows($sql);
if(!$email) {
$msg_to_user='<br/></br><h4><font color= "FF0000">Please input a Valid Email Address '$name' </font></h4>'
} else if ($numRows > 0){
$msg_to_user='<br/></br><h4><font color= "FF0000"> '$email' is already in the system </font></h4>'
}
else {
$sql_insert=mysql_query('INSERT INTO users (name,email)')
VALUES('$name','$email') or die (mysql_error())
$msg_to_user='<br/></br><h4><font color= "FF0000">Thanks '$name' you have been added successfully</font></h4>'
$cookie_name = "'$name'";
$cookie_value = "$email";
setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/"); // 86400 = 1 day
$name="";
$email="";
The line in question in the above code is
ThanksPHP Code:$msg_to_user='<br/></br><h4><font color= "FF0000">Please input a Valid Email Address '$name' </font></h4>'





Reply With Quote
