Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
determine number of entries
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
question....@hotmail.com  
View profile  
 More options Jan 29 2008, 7:58 am
Newsgroups: php.general
From: question....@hotmail.com
Date: Tue, 29 Jan 2008 04:58:14 -0800 (PST)
Local: Tues, Jan 29 2008 7:58 am
Subject: determine number of entries
Hello,

I have a form in which the user can add more textboxes as need be.

Ing1
Ing2
Ing3
....

There could be 1 input or there could be 30...

How can I, in php, determine the number of input controls so that I
can then loop through them one by one and process their data?

Thank you,

QB


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
question....@hotmail.com  
View profile  
 More options Jan 29 2008, 8:50 am
Newsgroups: php.general
From: question....@hotmail.com
Date: Tue, 29 Jan 2008 05:50:21 -0800 (PST)
Local: Tues, Jan 29 2008 8:50 am
Subject: Re: determine number of entries
After some tinkering, I have now setup a hidden input which houses the
count of the number of entries and it gets updated through the
javascript which dynamically alters the page.  I can then use it value
in my php code as my counter.

If there is a better approach I would be interested.

QB


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
la...@portcommodore.com  
View profile  
 More options Jan 29 2008, 9:53 am
Newsgroups: php.general
From: la...@portcommodore.com
Date: Tue, 29 Jan 2008 06:53:19 -0800 (PST)
Local: Tues, Jan 29 2008 9:53 am
Subject: Re: determine number of entries
On Jan 29, 5:50 am, question....@hotmail.com wrote:

> After some tinkering, I have now setup a hidden input which houses the
> count of the number of entries and it gets updated through the
> javascript which dynamically alters the page.  I can then use it value
> in my php code as my counter.

> If there is a better approach I would be interested.

> QB

I myself go for displaying the max necessary and then checking each
for content when processing.  Though it may put a big field of text
boxes on your form, but if the for is for data-entry savvy people
they'll appreciate not having to use extra controls to routinely add
something they need.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ZeldorBlat  
View profile  
(1 user)  More options Jan 29 2008, 11:13 am
Newsgroups: php.general
From: ZeldorBlat <zeldorb...@gmail.com>
Date: Tue, 29 Jan 2008 08:13:28 -0800 (PST)
Local: Tues, Jan 29 2008 11:13 am
Subject: Re: determine number of entries
On Jan 29, 8:50 am, question....@hotmail.com wrote:

> After some tinkering, I have now setup a hidden input which houses the
> count of the number of entries and it gets updated through the
> javascript which dynamically alters the page.  I can then use it value
> in my php code as my counter.

> If there is a better approach I would be interested.

> QB

Use arrays.  If your form elements look like this:

<input type="text" name="foo[]" />

Then they will be available as an array when you process it:

foreach($_SERVER['POST']['foo'] as $key => $value) {
    //do something with each one

}

And you can easily know how many there are:

count($_SERVER['POST']['foo'])


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google