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?? 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. 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>"; 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 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!! 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! 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. 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
Archived
This topic is now archived and is closed to further replies.