Peter,
On Aug 30, 2004, at 12:49 PM, Peter Ellis wrote:
It doesn't look like you're actually retrieving data using the $_POSTed data from that code snippet. Are you doing anything like $j = $_POST ['j']; in order to get the value of j before you retrieve your array data? Or are you allowing PHP to declare $_POST variables globally?
Yes, I tried setting the $_POST information to a variable, but that does not work either. I think I am allowing PHP to declare them globally... how is that done exactly?
The reason you need brackets is because brackets are always used in the declaration of a user array, assuming that this is what you want. If you don't want an array, than your original code was correct -- [] always signals an array type to PHP. -- Peter Ellis - pellis@xxxxxxxxxxxxxxx Web Design and Development Consultant naturalaxis | http://www.naturalaxis.com/
Do you recommend I use an array over a lot of variables? I can use either or - there was no particular reason why I chose a single variable.
Thanks, ~Philip
On Mon, 2004-08-30 at 11:02 -0500, Philip Thompson wrote:Peter,
On Aug 29, 2004, at 6:26 PM, Peter Lovatt wrote:
Hi
you need to check for $_POST["user1"], $_POST["user2"] etc - is that what you are doing?
Yes, this is how I am checking the post variables.
Your other variables are done as an array - $firstName[$j] etc, should
your
check box be
echo ' <td><input type="checkbox" name="user[' . $j . ']" value="1"></td>' . "\n";
(note the [])
Why do you have to have the []'s? I did add those, but it didn't seem to help.
Otherwise try vardump($_POST) to see exactly what is being returned.
I also tried the vardump($_POST), and it did not seem to return anything. I did not find anything about vardump() on the php site... besides some non-built in function. Any more thoughts on using it?
If this does not fix it try posting the code that handles the response
and
we will try and help.
Peter
Ok, quick question. Does the $_POST variable transfer the information
to all the pages? or just the page called in that <form
action="apage.php">? Because in my code I call a certain page, but then
that page merely redirects to another page, depending what selection
was made.
The code that uses the $_POST information follows...
~Philip
<?php
for ($j=0; $j<=$largestDBID; $j++) { $user = "user[" . $j . "]";
if ($_POST[$user]) { echo '<tr>' . "\n"; echo ' <td>' . $dbid[$j] . '</td>' . "\n"; echo ' <td>' . $firstName[$j] . '</td>' . "\n"; echo ' <td>' . $lastName[$j] . '</td>' . "\n"; echo ' <td>' . $uid[$j] . '</td>' . "\n"; echo ' <td>' . $username[$j] . '</td>' . "\n"; echo ' <td>' . $classification[$j] . '</td>' . "\n"; echo '</tr>' . "\n"; } }
?>
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php