Re: [PHP] HTTP_POST_VARS: Data there, but can't get to it
Name the form element without the brackets ... just whatdo instead of whatdo[]. When $whatdo[] makes it to your formhandler, it's an array. (You _could_ access $whatdo[0] ... but that may or may not be more confusing.) ~Chris /\ \ / September 11, 2001 X We Are All New Yorkers / \ rm -rf /bin/laden On Sat, 10 Nov 2001, Lara J. Fabans wrote: Just an addendum, I changed it from radio buttons to a pop up menu p select name=whatdo[] id=whatdo option value=load selectedLoad/option option value=deleteDelete/option option value=changeChange Category/option /select /p Again, if I print_r (HTTP_POST_VARS), I can see the Array ( [whatdo] = Array ( [0] = load [1] = delete), [other stuff]) but I cannot access it. I'm doing the same exact syntax for the image name=image[] which works perfectly. I can find nothing on this in the documentation or any of the other wonderful books websites out there. Please, what am I doing wrong in trying to access the HTTP_POST_VARS? Thanks, Lara At 08:36 AM 11/10/2001 -0800, Lara J. Fabans wrote: My bad for typing it in from memory. I'd retyped it in a few times, so I thought i had it perfect. Here's the exact code: print_r ($HTTP_POSTVARS); // yeilds the array that I pasted down below if ($flag==process) { $whatdo = $HTTP_POSTVARS['whatdo']; print_r($what_do); // blank . . . for ($x=0;$x=$row;$x++) { $whatdox = $whatdo[$x]; print $whatdox; // blank . . . //loop start tr td nowrap p input type=radio name=whatdo[?php print $row?] value=load checked Loadbr input type=radio name=whatdo[?php print $row?] value=delete Deletebr input type=radio name=whatdo[?php print $row?] value=change Change Category/p /td . . . - Lara J. Fabans Lodestone Software, Inc [EMAIL PROTECTED] At 09:41 AM 10/11/01, Lara J. Fabans wrote: Hi, I'm having some difficulties accessing HTTP_POST_VARS The original form has a table where each row has a set of 3 radio buttons name=whatdo?php print $x?[] where $x is the row counter. (I'm using PHP to pull info into a table, then the user manipulates the info, and it places the info into 2 other tables depending upon what the choice is for the 3 radio buttons). So, on submit, it reloads the page, and I pull in all of the areas. All work except the radio buttons. I've tried: $submitted_vars = $HTTP_POST_VARS; $whatdo = $submitted_vars[whatdo]; --- and $whatdo = $HTTP_POST_VARS[whatdo]; -- but when I do a print_r($whatdo) it's blank When I do a print_r($HTTP_POST_VARS) I get Array ( [whatdo] = Array ( [0] = load [1] = delete), [other stuff]) What am I doing wrong :-) How do I access this data? It's so frustrating since all the rest of the postvars are working, and I can see that the data's there in the HTTP_POST_VARSI just can't get to it. (pun not intended) - Lara J. Fabans Lodestone Software, Inc [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTTP_POST_VARS: Data there, but can't get to it
Hi This works (save as whatdo.php) !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN html headtitleWhatdo/title/head body ?php $rowcount = 2; $row = 0; //check for submit button pressed if($submit == Submit): while($row $rowcount): $postvar = whatdo-.$row; echo Row .$row. is .$HTTP_POST_VARS[$postvar].br; $row++; endwhile; else: ? table border=1 cellspacing=0 cellpadding=4 form action=whatdo.php method=post ?php while($row $rowcount): ? tr tdRow ?php echo $row? Options/td td nowrap input type=radio name=whatdo-?php echo $row? value=loadcheckedLoadbr input type=radio name=whatdo-?php echo $row? value=deleteDeletebr input type=radio name=whatdo-?php echo $row? value=changeChange Category /td /tr ?php $row ++; endwhile; ? tr td colspan=2 align=centerinput type=submit name=submit value=Submit/td /tr /form /table ?php endif; ? /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTTP_POST_VARS: Data there, but can't get to it
My bad for typing it in from memory. I'd retyped it in a few times, so I thought i had it perfect. Here's the exact code: print_r ($HTTP_POSTVARS); // yeilds the array that I pasted down below if ($flag==process) { $whatdo = $HTTP_POSTVARS['whatdo']; print_r($what_do); // blank . . . for ($x=0;$x=$row;$x++) { $whatdox = $whatdo[$x]; print $whatdox; // blank . . . //loop start tr td nowrap p input type=radio name=whatdo[?php print $row?] value=load checked Loadbr input type=radio name=whatdo[?php print $row?] value=delete Deletebr input type=radio name=whatdo[?php print $row?] value=change Change Category/p /td . . . - Lara J. Fabans Lodestone Software, Inc [EMAIL PROTECTED] At 09:41 AM 10/11/01, Lara J. Fabans wrote: Hi, I'm having some difficulties accessing HTTP_POST_VARS The original form has a table where each row has a set of 3 radio buttons name=whatdo?php print $x?[] where $x is the row counter. (I'm using PHP to pull info into a table, then the user manipulates the info, and it places the info into 2 other tables depending upon what the choice is for the 3 radio buttons). So, on submit, it reloads the page, and I pull in all of the areas. All work except the radio buttons. I've tried: $submitted_vars = $HTTP_POST_VARS; $whatdo = $submitted_vars[whatdo]; --- and $whatdo = $HTTP_POST_VARS[whatdo]; -- but when I do a print_r($whatdo) it's blank When I do a print_r($HTTP_POST_VARS) I get Array ( [whatdo] = Array ( [0] = load [1] = delete), [other stuff]) What am I doing wrong :-) How do I access this data? It's so frustrating since all the rest of the postvars are working, and I can see that the data's there in the HTTP_POST_VARSI just can't get to it. (pun not intended) Thanks, Lara - Lara J. Fabans Lodestone Software, Inc [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTTP_POST_VARS: Data there, but can't get to it
Just an addendum, I changed it from radio buttons to a pop up menu p select name=whatdo[] id=whatdo option value=load selectedLoad/option option value=deleteDelete/option option value=changeChange Category/option /select /p Again, if I print_r (HTTP_POST_VARS), I can see the Array ( [whatdo] = Array ( [0] = load [1] = delete), [other stuff]) but I cannot access it. I'm doing the same exact syntax for the image name=image[] which works perfectly. I can find nothing on this in the documentation or any of the other wonderful books websites out there. Please, what am I doing wrong in trying to access the HTTP_POST_VARS? Thanks, Lara At 08:36 AM 11/10/2001 -0800, Lara J. Fabans wrote: My bad for typing it in from memory. I'd retyped it in a few times, so I thought i had it perfect. Here's the exact code: print_r ($HTTP_POSTVARS); // yeilds the array that I pasted down below if ($flag==process) { $whatdo = $HTTP_POSTVARS['whatdo']; print_r($what_do); // blank . . . for ($x=0;$x=$row;$x++) { $whatdox = $whatdo[$x]; print $whatdox; // blank . . . //loop start tr td nowrap p input type=radio name=whatdo[?php print $row?] value=load checked Loadbr input type=radio name=whatdo[?php print $row?] value=delete Deletebr input type=radio name=whatdo[?php print $row?] value=change Change Category/p /td . . . - Lara J. Fabans Lodestone Software, Inc [EMAIL PROTECTED] At 09:41 AM 10/11/01, Lara J. Fabans wrote: Hi, I'm having some difficulties accessing HTTP_POST_VARS The original form has a table where each row has a set of 3 radio buttons name=whatdo?php print $x?[] where $x is the row counter. (I'm using PHP to pull info into a table, then the user manipulates the info, and it places the info into 2 other tables depending upon what the choice is for the 3 radio buttons). So, on submit, it reloads the page, and I pull in all of the areas. All work except the radio buttons. I've tried: $submitted_vars = $HTTP_POST_VARS; $whatdo = $submitted_vars[whatdo]; --- and $whatdo = $HTTP_POST_VARS[whatdo]; -- but when I do a print_r($whatdo) it's blank When I do a print_r($HTTP_POST_VARS) I get Array ( [whatdo] = Array ( [0] = load [1] = delete), [other stuff]) What am I doing wrong :-) How do I access this data? It's so frustrating since all the rest of the postvars are working, and I can see that the data's there in the HTTP_POST_VARSI just can't get to it. (pun not intended) - Lara J. Fabans Lodestone Software, Inc [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTTP_POST_VARS: Data there, but can't get to it
On Fri, 9 Nov 2001, Lara J. Fabans wrote: The original form has a table where each row has a set of 3 radio buttons name=whatdo?php print $x?[] where $x is the row counter. Well, for a set of raido buttons, they should all have the same name. In your case, all 3 radio buttons should be named whatdo. Don't put on any brackets ... that will cause whatdo to be an array when it's being handled by the form handler. Then you can check $HTTP_POST_VARS['whatdo'] for the value of the checked radio button when the form was submitted. g.luck, ~Chris /\ \ / September 11, 2001 X We Are All New Yorkers / \ rm -rf /bin/laden -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]