RE: [PHP-DB] Webpage response to selection & $_POST
| From: | Peter Lovatt | Date: | Sun, 29 Aug 2004 23:26:59 +0000 |
| Subject: | RE: [PHP-DB] Webpage response to selection & $_POST | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-35935@lists.php.net to get a copy of this message | ||
Hi
you need to check for $_POST["user1"], $_POST["user2"] etc - is that what
you are doing?
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 [])
Otherwise try vardump($_POST) to see exactly what is being returned.
If this does not fix it try posting the code that handles the response and
we will try and help.
Peter
> -----Original Message-----
> From: Philip Thompson [mailto:prthomp@uark.edu]
> Sent: 30 August 2004 00:12
> To: php-db@lists.php.net
> Subject: [PHP-DB] Webpage response to selection & $_POST
>
>
> Hi all.
>
> I have a list of users in a database that I would like to show on a
> dynamic webpage. With each of these users that shows up on the page,
> there is going to be a checkbox next to their name so that I can
> perform multiple tasks, such as 'Remove User' or 'Modify Information'.
> I have all of the appropriate information showing up on the page,
> including the checkboxes.
>
> My question is... if I select a checkbox for a user, the other pages do
> not even recognize that I have selected that checkbox and I am using
> the $_POST method - why is that? I have even attempted to use the
> import_request_variables function - no luck. So, I cannot verify which
> users I want to perform an action on.
>
> Anyone have any ideas? Snippets of code to follow...
>
> Thanks in advance,
> ~Philip
>
>
> <form action="performaction.php" method="post">
> <table>
> <?php
> for ($j=0; $j<$numRows; $j++) {
> echo '<tr>' . "\n";
> echo ' <td><input type="checkbox" name="user' . $j .
> '"
> value="1"></td>' . "\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";
> }
> ?>
> </table>
>
> <input type="submit" name="removeuser" value="Remove User"
> />
> <input type="submit" name="modifyclass" value="Modify
> Classification" />
> <input type="hidden" name="beenSubmitted" value="1" />
> </form>
>