fishbaitfood Posted August 4, 2010 Share Posted August 4, 2010 Hi, So, I have two sessions. One's for displaying an array. Is there some kind of function to make a session invisible? Because when I display an error for not filling in, the previous words of the array show up behind the error message. Like this: $error = 'Please enter a word.' Output: Please enter a word.word word word So is there a way to make my Session Invisible (not removing any words from array)? Quote Link to comment https://forums.phpfreaks.com/topic/209797-make-session-invisible/ Share on other sites More sharing options...
PFMaBiSmAd Posted August 4, 2010 Share Posted August 4, 2010 You would need to post the actual code that demonstrates the problem. Quote Link to comment https://forums.phpfreaks.com/topic/209797-make-session-invisible/#findComment-1095151 Share on other sites More sharing options...
wildteen88 Posted August 4, 2010 Share Posted August 4, 2010 Because when I display an error for not filling in, the previous words of the array show up behind the error message. Huh? How is that possible. Could you post the code that outputs the error and a screenshot of your problem. This sounds more like a HTML/CSS issue to me. Quote Link to comment https://forums.phpfreaks.com/topic/209797-make-session-invisible/#findComment-1095152 Share on other sites More sharing options...
fishbaitfood Posted August 4, 2010 Author Share Posted August 4, 2010 Here's the code: <?php ... $error = 'Please enter a word.'; ... ?> ... <p> <?php if ($error != '') { echo $error; } if (isset($_SESSION['words'])) { echo implode(' ',$_SESSION['words']); } ?> </p> [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/209797-make-session-invisible/#findComment-1095158 Share on other sites More sharing options...
wildteen88 Posted August 4, 2010 Share Posted August 4, 2010 Not understanding that, need to see more code. Could you explain what it is you're trying to do. Quote Link to comment https://forums.phpfreaks.com/topic/209797-make-session-invisible/#findComment-1095162 Share on other sites More sharing options...
Alex Posted August 4, 2010 Share Posted August 4, 2010 That's because you're echoing the array.. isn't what you want to do just not echo this?: echo implode(' ',$_SESSION['words']); Quote Link to comment https://forums.phpfreaks.com/topic/209797-make-session-invisible/#findComment-1095163 Share on other sites More sharing options...
fishbaitfood Posted August 4, 2010 Author Share Posted August 4, 2010 Sorry.. Here's the whole bunch of code (see attachment) So basically, when I submit the empty form (the array form), I get a message saying 'Please enter a word.'. Nothing wrong with that. But when I previously entered some words, they show up behind my error message. So I need to find a way to make my array invisible, when showing the error message. @ AlexWD: lol, yes.. So do I need to put the echo command somewhere else? [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/209797-make-session-invisible/#findComment-1095165 Share on other sites More sharing options...
wildteen88 Posted August 4, 2010 Share Posted August 4, 2010 So you only want to show the words previously entered if there is no error message? Change your two if's to if/elseif if ($error != '') { echo $error; } elseif (isset($_SESSION['words'])) { echo implode(' ',$_SESSION['words']); } Quote Link to comment https://forums.phpfreaks.com/topic/209797-make-session-invisible/#findComment-1095172 Share on other sites More sharing options...
fishbaitfood Posted August 4, 2010 Author Share Posted August 4, 2010 So you only want to show the words previously entered if there is no error message? Change your two if's to if/elseif if ($error != '') { echo $error; } elseif (isset($_SESSION['words'])) { echo implode(' ',$_SESSION['words']); } haha, that simple...!! Thanks for the adjustment! ~~~~~~~ SOLVED Quote Link to comment https://forums.phpfreaks.com/topic/209797-make-session-invisible/#findComment-1095176 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.