Jump to content

Help with error


bkribbs

Recommended Posts

Hey, I am new to PHP. I am experimenting with cookies, and am having some trouble with the syntax for part of it. I am checking if that cookie exists, and if it is there, I want it to say, you are logged in as "(cookie has username stored)"

 

<?php

if( isset( $_COOKIE['username'] ) )

{

echo 'You are logged in as', var_dump($_COOKIE );

}

else

{

echo 'you aren't logged in!';

}

?>

 

I'm sure this is simple, but I don't know. Thanks guys!

Link to comment
https://forums.phpfreaks.com/topic/253824-help-with-error/
Share on other sites

When using the same type of quote within a string as the quotes that enclose the string, you must escape the enclosed quotes.

 

See the manual regarding string data, and how to escape quotes, etc. http://www.php.net/manual/en/language.types.string.php

 

echo 'you aren't logged in!';

Link to comment
https://forums.phpfreaks.com/topic/253824-help-with-error/#findComment-1301279
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.