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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.