Jump to content

Make session invisible


fishbaitfood

Recommended Posts

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)?

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Sorry.. Here's the whole bunch of code (see attachment) :D

 

 

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..  :D So do I need to put the echo command somewhere else?

 

 

[attachment deleted by admin]

Link to comment
Share on other sites

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']);
  }

Link to comment
Share on other sites

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...!!  :D  Thanks for the adjustment!

 

~~~~~~~

SOLVED

 

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.