HTML Submit Blank Form Fields

HTML Submit Blank Form Fields

am 03.04.2008 17:19:09 von kagreen2002

I have a form that updates a database table row. The form sends back
all fields that are filled in, and my CGI updates those fields. My
problem is if a user blanks out a field, that field is not sent
back, ,and so the CGI does not update the field to blank.

Is there a way for the form to submit all fields regardless of whether
data is entered in them?

Thanks.

Re: HTML Submit Blank Form Fields

am 03.04.2008 21:39:18 von lws4art

kagreen2002@yahoo.com wrote:
> I have a form that updates a database table row. The form sends back
> all fields that are filled in, and my CGI updates those fields. My
> problem is if a user blanks out a field, that field is not sent
> back, ,and so the CGI does not update the field to blank.
>
> Is there a way for the form to submit all fields regardless of whether
> data is entered in them?

No, but what you can do is have your CGI script have a list of
*expected* fields and compare to to the list of *received* field and any
ones missing use null value, i.e., you preset them with an acceptable
value. Your script should be restricted to only those field names that
you have predefined. Know exactly what type and quantity of data is
permissible. Check it before using such data and discard or deal with it
appropriately if it does not conform. If you don't you most likely have
an insecure and possibly dangerous script.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

Re: HTML Submit Blank Form Fields

am 04.04.2008 03:34:41 von Adrienne Boswell

Gazing into my crystal ball I observed kagreen2002@yahoo.com writing in
news:01298e4d-4c67-4d6a-ac47-e102f03e0bc9@u69g2000hse.google groups.com:

> I have a form that updates a database table row. The form sends back
> all fields that are filled in, and my CGI updates those fields. My
> problem is if a user blanks out a field, that field is not sent
> back, ,and so the CGI does not update the field to blank.
>
> Is there a way for the form to submit all fields regardless of whether
> data is entered in them?
>
> Thanks.

If you are using input type text, you should receive an empty value upon
submission. The only exceptions are radio, checkbox and select.
However, if you specify a default value, you should get those as well,
eg:
Default
A
Default
A


Again, as Jonathan said, your server side script should check these
fields before sending anything to the database.

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share