gaza165 Posted October 8, 2008 Share Posted October 8, 2008 echo "<tr><td><input type='text' name='name' value='$_SESSION[/'name/']'></td><td><input type='text' name='email'></td></tr>"; can someone tell me how to echo the session variable properly?? Quote Link to comment https://forums.phpfreaks.com/topic/127474-how-to-echo-this-properly/ Share on other sites More sharing options...
F1Fan Posted October 8, 2008 Share Posted October 8, 2008 Any array ($_SESSION included) need {} brackets around them. Quote Link to comment https://forums.phpfreaks.com/topic/127474-how-to-echo-this-properly/#findComment-659510 Share on other sites More sharing options...
F1Fan Posted October 8, 2008 Share Posted October 8, 2008 To clarify: echo "<tr><td><input type='text' name='name' value='{$_SESSION['name']}'></td><td><input type='text' name='email'></td></tr>"; Quote Link to comment https://forums.phpfreaks.com/topic/127474-how-to-echo-this-properly/#findComment-659511 Share on other sites More sharing options...
phatgreenbuds Posted October 8, 2008 Share Posted October 8, 2008 CSS is answer. Liberal use of DIV tags and CSS fixes almost anything Quote Link to comment https://forums.phpfreaks.com/topic/127474-how-to-echo-this-properly/#findComment-659512 Share on other sites More sharing options...
AndyB Posted October 8, 2008 Share Posted October 8, 2008 News to me that any array variable needs braces. Guess I should change all my code :-\ Alternatively: echo "<tr><td><input type='text' name='name' value='". $_SESSION['name']. "'></td><td><input type='text' name='email'></td></tr>"; @phatgreenbuds - not even CSS is powerful enough to fix php syntax errors!! Quote Link to comment https://forums.phpfreaks.com/topic/127474-how-to-echo-this-properly/#findComment-659515 Share on other sites More sharing options...
F1Fan Posted October 8, 2008 Share Posted October 8, 2008 LOL! That isn't what I meant. I must be tired! What I meant is that any array within a single-quoted string must have brackets around it, unless your method is used. Sorry! Quote Link to comment https://forums.phpfreaks.com/topic/127474-how-to-echo-this-properly/#findComment-659516 Share on other sites More sharing options...
AndyB Posted October 8, 2008 Share Posted October 8, 2008 @ F1Fan - no prob. I've made more mistakes than I've had hot dinners. Quote Link to comment https://forums.phpfreaks.com/topic/127474-how-to-echo-this-properly/#findComment-659517 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.