while executing the below program i am getting the error "Parse error: syntax error, unexpected '<<' (T_SL) in C:\xampp\htdocs\registration.php on line 5" . can i get some help ??

<?php
extract($_POST);
include "connection.php";
$link= md5($txtuname);
$str= <<<abc 
account is created click on the activation link <a href="http://abc.com/active.php?$link">click </a>
abc;
if(mysql_query("insert tbl_user values ('$txtuname','$txtpwd','$txtemail','0','$link')"))
{
    echo "registration completed";
    mail($txtemail,"activation link", "$str","from: admin@abc.com \r \n content type:text/html");
}
else
{
    if (mysql_error()==1062)
    {
        echo "username exist";
    }
}
?>

Recommended Answers

All 4 Replies

That works for me and I can't see anything wrong. But you should check for whitespace on line 7 though. Extra white space can interfere with <<< functionality.
Putting a space at the end of line 7 broke what was working for me just now.

Please mysql is deprecated, try to get used to mysqli or PDO.

thanks but after removing the white space now m getting error like "Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\registration.php on line 20"

<?php
extract($_POST);
include "connection.php";
$link= md5($txtuname);
$str = <<<abc
account is created click on the activation link <a href="http://abc.com/active.php?$link">click</a>
abc;  
if(mysql_query("insert tbl_user values ('$txtuname','$txtpwd','$txtemail','0','$link')"))
{
    echo "registration completed";
    mail($txtemail,"activation link", "$str","from:admin@abc.com \r \n contenttype:text/html");
}
else
    {
        if(mysql_error()==1062)
        {
        echo "username exist";
        }
    }
?>

I think the <<<abc abc in the $str is causing the error. Please use this

$str = "Account is created click on the activation link <a href=\"http://abc.com/active.php?$link\">Click</a>";

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.