You are here: Re: Validating form input data « PHP Programming Language « IT news, forums, messages
Re: Validating form input data

Posted by Jerry Stuckle on 10/15/75 11:46

stathis gotsis wrote:
> Hello everyone,
>
> I am tying to come up with an elegant way to process some input data that
> come from a form. When the user hits the 'Submit' button, i want the form to
> appear again with the already entered valid data filled in and prompt the
> user to re-enter the non-valid data. If all data is valid, i will forward to
> an other .php page which enters the data into a database.
>
> I tried to do this in the following way: the form always hits back on
> itself, but when all data is valid i use the PHP:header() to redirect to the
> data.php that performs the database insertion. The problem is that the data
> is not available to data.php in the $_POST variable. How can i overcome this
> problem? Any other subtle way to handle the whole thing? Any help
> appreciated.
>
>

Stathis,

I do things the same way you do - the page validates its own input and then uses
header() to move to the next page. But before the header() call, I store the
data in the $_SESSION variable.

I prefer validating the data in the same page that contains the data. It keeps
the code together and, IMHO, cleaner. Plus, if it isn't needed in the next
page, you don't even have to touch that page.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this 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

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