Re: INSERT problem--Need help urgently
| From: | Jason Wong | Date: | Tue, 30 Mar 2004 12:24:36 +0000 |
| Subject: | Re: INSERT problem--Need help urgently | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-33698@lists.php.net to get a copy of this message | ||
On Tuesday 30 March 2004 20:13, irinchiang@justeducation.com wrote:
> okay I have echoed $sql and before I did enter anything into the form, the
> form is already inserting null values into the database. Maybe that is the
> reason for the duplicate row of null values.
Yes, that would be the reason.
> Do you know how can I prevent this from happening??Hope to hear from you
> soon.
You're not performing any checks on the input you're getting from your form.
The most simple check for whether the form was submitted is to use:
if (!empty($_POST)) { // form was submitted }
or
if (!empty($_GET)) { // form was submitted }
In addition you should always perform sanity checks on values of the
individual form elements. Search the archives/web for 'sql injection' for
more info.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
------------------------------------------
/*
Place me on a BUFFER counter while you BELITTLE several BELLHOPS in the
Trianon Room!! Let me one of your SUBSIDIARIES!
*/