Reply to Re: unable to retain values in text box

Your name:

Reply:


Posted by Rik on 05/30/06 11:18

Ian Davies wrote:
> hi jerry
> the data is in a session, and it retains itself during the first form
> post. however I cannot get it to remain when the second form posts,
> even though the sessions are still true and the textbox and
> radiobuttons values are are still set to the session. I think it has
> to do with the second form somehow. it seems that it is influencing
> the textbox and radiobutton's values. but i cant work out why
> ian

I suspect the problem is this:
$_SESSION['pupilfield'] = trim($_POST['pupilfield']);
$_SESSION['gender'] = trim($_POST['gender']);

After the second form, this $_POST values are non-existent, so null, and
hence $_SESSION[key] get's set to null.

Use:
$_SESSION[key] = (isset($_POST[key])) ? trim($_POST[key]) : $_SESSION[key];

Grtz,
--
Rik Wasmus

[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

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