Re: [PHP-DB] Webpage response to selection $_POST

2004-08-30 Thread Philip Thompson
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 - [EMAIL PROTECTED]
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 ' tdinput 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


Re: [PHP-DB] Webpage response to selection $_POST

2004-08-30 Thread Ng Hwee Hwee
hi...

to what i know, the $_POST variables get passed to apage.php only... if you
have a redirect to another page inside apage.php, the $_POST variables will
not be passed to the next page. you may need to register your $_POST as
session variables inside apage.php first or you append your $_POST variables
to your redirect string...

e.g. header('location: nextpage.php?var='$_POST) or something like that...

- Original Message - 
 On Mon, 2004-08-30 at 11:02 -0500, Philip Thompson wrote:
  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.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Webpage response to selection $_POST

2004-08-29 Thread Philip Thompson
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 '	tdinput 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


RE: [PHP-DB] Webpage response to selection $_POST

2004-08-29 Thread Peter Lovatt
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 ' tdinput 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:[EMAIL PROTECTED]
 Sent: 30 August 2004 00:12
 To: [EMAIL PROTECTED]
 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 '   tdinput 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


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php