Jump to content

[SOLVED] PHP Question


Canman2005

Recommended Posts

Hi all

 

I have a HTML form which has the following fields

 

<input id="txtRow1" name="txtRow1" type="text">
<input id="txtRow2" name="txtRow2" type="text">
<input id="txtRow3" name="txtRow3" type="text">
<input id="txtRow4" name="txtRow4" type="text">

 

as you can see, the name of the field is "txtRow" followed by a number

 

some of my pages have just 2 of the above fields and some pages have up to 45 (so going from "txtRow1" to "txtRow45").

 

When the form is submitted, I want to run a query for each textfield that exists.

 

I was going to initally do

 

if($_POST['txtRow1'] != '')
{
}
if($_POST['txtRow2'] != '')
{
}
if($_POST['txtRow3'] != '')
{
}

 

and so on, but I think that might make my page really long and going forward some pages could have up to 120 of these textfields.

 

Is there an easy way to do this?

 

Hope I make some kind of sense

 

thanks in advance everyone

 

dave

Link to comment
https://forums.phpfreaks.com/topic/172021-solved-php-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.