|
-
Jan 12th, 2004, 11:17 AM
#1
Thread Starter
Frenzied Member
get number of elements in POST
I have a page where a user will be entering numbers into text boxes. The number of textboxes will vary, and I need to update a database with the values entered in these boxes.
So is there a way to determine how many values are being passed in the POST method?
something like:
PHP Code:
While($check==1)
{
$box=databox$i;
if($_POST[$box]!="")
{
/// run SQL query to update DB for that value
}
else
check=0;
$i++;
}
Something close to that... !?
-
Jan 12th, 2004, 11:42 AM
#2
Stuck in the 80s
Something like this will loop $_POST:
Code:
foreach ($_POST as $key => $value) {
echo "$_POST['$key'] = $value<br />";
}
-
Jan 13th, 2004, 05:53 AM
#3
If you give the textboxes in the form names like
<input type="text" name="txtbox[0]" />
you can retrieve the count of them in PHP with a simple
Code:
<?php echo count($_POST['txtbox']); ?>
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|