|
Posted by Manuel Lemos on 11/19/30 11:46
Hello,
on 04/30/2006 12:17 PM Jerry Stuckle said the following:
>>> 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.
>>
>>
>> Nothing stops you from presenting the form and process it with the same
>> script.
>>
>> You may want to take a look at this forms generation and validation
>> class that shows you how to do that. Additionally it generates your
>> forms with Javascript to validate the form also on the client site,
>> avoiding unnecessary server round trips just to tell the user the form
>> has invalid fields.
>>
>> http://www.phpclasses.org/formsgeneration
>>
>>
>
> And what happens if someone has javascript turned off?
>
> NEVER rely on client side validation!
This is a very mature class. It implements server side validation since
when it was released for the first time in 1999 . It generates client
side validation Javascript code to reduce server needless round trips
and so improve user-friendliness.
--
Regards,
Manuel Lemos
Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
[Back to original message]
|