2

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

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.