CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
form problem



Feb 26, 2001, 4:26 AM

Post #1 of 2 (378 views)
form problem Can't Post

Okay, so this is really more of a html problem, but I encountered it working with perl, and the form is actually in a cgi program...

This is what I am trying to do:

1. A foreach loop lists several lines (could be any number of lines) with lots of info - part #, quantity, price etc. At the end of each line, there is a checkbox.

2. Price and quantity are in text fields, and the user can change the value. The user checks one or more checkboxes, and the information on the lines with checked boxes gets sent to a cgi processing the input.

PROBLEM: The values of ALL text fields get sent! I ONLY want to send them if the checkbox at the end of the line is checked... how do I make the checkbox apply to the text fields also?

example of outputted code (stripped down to essentials..):

<form action=mycgi.cgi method=post>
<input type=text size=5 name=$qty value=quantity> # name variable values are incremented for every line with the foreach loop
<input type=text size=5 name=$tpr value=target>
<input type=checkbox name=$ok value=result> # part nr and other stuff is stored in $ok

<input type=text size=5 name=$qty value=quantity>
<input type=text size=5 name=$tpr value=price>
<input type=checkbox name=$ok value=result>
<input type=submit>


Mar 2, 2001, 2:47 PM

Post #2 of 2 (357 views)
Re: form problem [In reply to] Can't Post

you should check the values of each text variable in your CGI. then take appropriate action if the fields are blank.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives