Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't put hyperlink in PHP echo statement

Tags:

php

In the code below I'm adding <a href=\"member.php\"></a> in the echo statement. But, I'm getting a syntax error when I add any hyperlink in my PHP. Is there something I'm missing here? Thank you.

if ($username==$dbusername && $password==$dbpassword)
                {
                    echo "You're in!  <a href=\"member.php\"><!--I'm getting the sytax error in the hyper link here.-->Click here</a> to enter the member area";
                    }

                    else                
                        echo "Incorrect username/password";
                        }

                        else
                            die('That user does not exist');
                            }

    else
        die('Please enter a username/password');

    ?>

UPDATE

Updated with escape tags.

like image 598
Graham Avatar asked May 26 '26 04:05

Graham


1 Answers

You need to escape your quotes:

echo "You're in! <a href=\"member.php\">Hello!</a>";
like image 165
mfonda Avatar answered May 27 '26 16:05

mfonda