masterinex Posted August 24, 2017 Share Posted August 24, 2017 <?php // Start the session session_start(); ?> <!DOCTYPE html> <html> <body> <?php // Set session variables $_SESSION["favcolor"] = "green"; $_SESSION["favanimal"] = "cat"; $_SESSION["favmeal"] = "shep"; echo "Session variables are $_SESSION[\"favmeal\"] " ; ?> </body> </html> what is wrong with this code, how come it wont show favmeal ? Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted August 24, 2017 Share Posted August 24, 2017 How about you concentrate on one problem at a time? You now have three threads pending, and it's entirely unclear which answers you've read and what you actually understand. The code is syntactically invalid. Turn your error reporting up, and PHP will tell you exactly what's wrong. If you want to know how to insert array values into strings, read the manual. Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted August 24, 2017 Share Posted August 24, 2017 You could also check out "Complex (curly) syntax". http://php.net/manual/en/language.types.string.php#language.types.string.parsing.complex Note that you could come across the same information using Jacques1's link. But I know its tempting to stop reading a manual as soon as workable solution is found. Quote Link to comment Share on other sites More sharing options...
fatkatie Posted August 24, 2017 Share Posted August 24, 2017 I was brand new to php a few months ago. This PHP command line lint facility REALLY helped me. Still does. php -l filename.php Quote Link to comment Share on other sites More sharing options...
ginerjm Posted August 25, 2017 Share Posted August 25, 2017 Brand new to PHP a few months ago? I wouldn't consider you to be 'brand new' unless you just aren't that interested in learning it. Quote Link to comment Share on other sites More sharing options...
Barand Posted August 25, 2017 Share Posted August 25, 2017 @ginerjm - Apparently you do not understand the use of the past tense in English. S/he said "was brand new to PHP a few months ago". Just as you and I were once brand new to it, Quote Link to comment Share on other sites More sharing options...
ginerjm Posted August 25, 2017 Share Posted August 25, 2017 My apologies. I did miss the "was". Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.