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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need PHP Table Create Form pass select table parameters 1

Status
Not open for further replies.

SundancerKid

Programmer
Joined
Oct 13, 2002
Messages
116
Location
US
I have a Table that has 20 rows per page, each row contains Production Information and specs, also each row has a Check Box on it. I have a submit button that I would like to open up a form and pass the rows of data that have been checked to the form. How do I do this? Examples would be great..

Thanks

Rick P.
 
I have a table that is displayed on a web page. Each row contains 5 Product information fields along with a check box that is set to false(Unchecked). When ever the submit button is checked I would like to evaluate each Check Box row on the table. If the box is checked I would like to pass that information to a Request for more Information Form for emailing to me.

I have never done this before.
Examples would be great.
 
There's not much you have to do. With checkboxes, only those boxes checked are transmitted to the server.

There is a trick with PHP and form field-names that you will probably find useful. If you create field-names that look like PHP array references, PHP will interpret that input as an array in your script.

For example, with the following HTML form with 5 checkboxes:

Code:
<html>....<form method="post" action="somescript.php">
<input type="checkbox" [red]name="foo[]" value="1">
<input type="checkbox" [red]name="foo[]" value="2">
<input type="checkbox" [red]name="foo[]" value="3">
<input type="checkbox" [red]name="foo[]" value="4">
<input type="checkbox" [red]name="foo[]" value="5">
<input type="submit"></form>.....</html>

And a user checks the 2nd and 4th checkboxes and submits, in the PHP script, $_POST[foo] would itself be an array that contains two elements. Each element's value would be the value attribute from the checked checkboxes.

You can then loop through that array and process the input.


You can also specify array element numbers in the form field-names. This way, if necessary you can specify array index values, too.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Hi sleipnir214,

do you have any more example code.

I am fairly new to PHP and email forms.
 
No, I do not have example code.

If you're new to PHP, I recommend that you get familiar with the layout of the PHP online manual. The manual is well-written and contains lots of example code sample.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top