Reply to Re: Session variable

Your name:

Reply:


Posted by Shelly on 07/10/05 03:03

"Shelly" <sheldonlg.news@asap-consult.com> wrote in message
news:MMCdnVR-XpSDtk3fRVn-ow@comcast.com...
> I'm going nuts over this one. Perhaps this is kludgy, but it has worked
> for me before.
>
> When I give the user a form, say AAA.php that has a few fields on it, and
> he has to fill it out, I check for validity. If I find an error, I
> created a session variable like:
>
> $_SESSION['AnError'] = "Description of the error";
>
> I then call the form again with
>
> header("Location: ThisForm.php");
>
> In the <body> area I have
>
> <?php if (isset($_SESSION['AnError'])) echo $_SESSION['AnError']; ?>
>
> Doing thing like this has worked before. Now, for a particular form when
> I try it, it doesn't display. I tested it further with
>
> <?php echo "Error: . $_SESSION['AnError']; ?>
>
> and only the "Error: " displayed. This told me that the session variable
> was not set. However, if I put echos in the code immediately after it
> gets set, then it echos and prints further that the headers have already
> been set (BTW, what does that mean?). So, I know that it is being set, it
> is not being unset anywhere, yet it isn't set when the form redisplays.
>
> I have been banging my head against the wall for hours now. Anyone have
> any ideas?
>
> Shelly
>
>

Well, it works now. I am not sure why, but here is what I did. After I had
echoed the variable in the <body> area, I had unset it since I didn't want
to keep it around after the display. What I changed was that I removed
that unset and placed it where I successfully started to upload the file
that I wanted. In other words, where there were no client side errors.

Could someone explain to me why that works? Is it that it does the page
twice on redisplay, getting the variable on the first time but then it
doesn't have it on the second pass (after the original unset)?

Shelly

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация