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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.