Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

stripping empty fields

Status
Not open for further replies.
Jul 9, 2001
3
0
0
CA
hello,
does anyone know of a form mail script that will strip empty fields. I have a form that uses a quantity field. When the data is sent, all of the fields empty or not are sent. This is unnacceptable as the forms have more than 140 products and if someone fills out five fields to order we get all 140 to weed through and print out. Any ideas?
thanks
David
 
I am not sure if I understand your question 100%, but are you just asking to check a field and see if its empty or not?

You could do that by using the length() function in perl, such as:
[tt]
if (length($FORM{'fieldname'} >= 1) {
print "length greater than one";
}
[/tt]

Is that what you are asking? You could also just do:

[tt]
if ($FORM{'fieldname'}) {
print "length greater than one.";
}
[/tt]

Am I understanding your question correctly? If so, you could loop over the $FORM hash (or whatever it is in your script) and check each value. Thats how I would do it.

Hope this helps.

-Vic vic cherubini
krs-one@cnunited.com
====
Knows: Perl, HTML, JavScript, C/C++, PHP, Flash
====
 
Hello
thanks for the response. I am not a programmer and have learned to use the default cgi form send from the ISP. I am really confused about how to do this so maybe I am just too unknowledgeable in this area.
thanks anyway
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top