tags:

views:

19

answers:

2

Hi there! I am currently using a PHP 5 along with Netbeans IDE to create a login page.

However Netbeans seems to not understand the codes that I have added into the console box.

The error originates from the "echo "....." line.

The codes are as follows:

$query = mysql_query($sql) or die(mysql_error());
 echo "Thank You for registering {$first_name}! Your username is {$username}";
 echo "<a href="index.php"> Click here </a> to Login";
}
}
?>

The errors shown are:

-Syntax error: Unexpected : Index -Syntax error: Unexpected : String

Please do help. Thanks.

+1  A: 

from

 echo "<a href="index.php"> Click here </a> to Login";

to

 echo "<a href=\"index.php\"> Click here </a> to Login";

You have to escape those "" or use '' like so:

 echo '<a href="index.php"> Click here </a> to Login';

But watch out on that first echo you MUST use "" since you are using variables in it.

Iznogood
Thanks dude! Your answer helped!
JavaNoob
You are welcome sir!
Iznogood
A: 

Try:

 echo "Thank You for registering {$first_name}! Your username is {$username}",
            '<a href="index.php"> Click here </a> to Login';

or:

        echo sprintf("Thank You for registering %s! Your username is %s\n<a href='index.php'> Click here </a> to Login",
                        $first_name, $username);
Jet