FW: [PHP-DB] error checking question
| From: | David Shugarts | Date: | Fri, 27 Jun 2003 00:30:54 +0000 |
| Subject: | FW: [PHP-DB] error checking question | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-28932@lists.php.net to get a copy of this message | ||
------ Forwarded Message
> From: David Shugarts <Azimuth@CompuServe.com>
> Date: Thu, 26 Jun 2003 18:53:53 -0400
> To: <dpgirago@mdanderson.org>
> Subject: Re: [PHP-DB] error checking question
>
> Hi, David--
>
> The question you are asking belongs to the topic or concept called "form
> validation" and you will see lots of hits about it on a Google search. I have
> been looking at the same issue and I am impressed with one solution,
> http://www.x-code.com/vdaemon_web_form_validation.php. However,
> I am
> interested in what other people might think.
>
> With the help of this List, I have had some success in validation of one or
> two variables in a form, but this solution, vdaemon, represents an attempt to
> cover the complete spectrum of the variables people most often want to
> validate. I feel it may be on the right track (even though the one I wish to
> validate isn't covered).
>
> --Dave Shugarts
>
>>
>>
>>
>> Hello everyone,
>>
>> I've been experimenting with checking for errors in data inserted into a
>> table
>> using an html form. The main page displays the result of a "select * from
>> the_table" at the top of the page, with the form for inserting the data
>> beneath.
>> The SQL for the insert occurs on a different page, with redirection back to
>> the
>> main page using the header() function ( as I've learned to do from reading
>> this
>> list ). This all works well. The inserted data shows up in the table, and
>> there
>> are no surprises when refreshing, etc... I have also implemented some error
>> checking on the client side using JavaScript, and this is also working well.
>>
>> What I would like to do is somehow have a redundant error check on the server
>> side and then display an error message above the form on the main page should
>> fields be left blank or forbidden characters entered. Since I have access to
>> the
>> $_POST['variables'] on the form processing page, I've already written some
>> code
>> to detect the presence of error characters, etc...and no query is performed
>> if
>> there is an error. But how do I pass a "flag" variable back to the main page
>> to
>> echo an appropriate message above the form?
>>
>> Advice or suggestions greatly appreciated.
>>
>> David
>>
>>
------ End of Forwarded Message