Re: [PHP] $HTTP_POST_VARS
Hi AH> Whats the advantage (or shall i say disadvantage )of passing form variables to a function like shown below: AH> function function_name($var,$var1,$var2) AH> { AH> } AH> rather than passing the $HTTP_POST_VARS array to the fuction like: AH> function function_name($HTTP_POST_VARS) AH> { AH> } AH> Is any better than other? or both the same? AH> awlad Use $_POST and pass nothing to the function. It is superglobal array. -- Regards Anton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $HTTP_POST_VARS problem
Problem solved: I forgot to add the enctype to the original FORM tag. Cheers, Lee, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $HTTP_POST_VARS problem
It looks to me like you are trying to get an uploaded file? If so, it isn't $HTTP_POST_VARS, it is $HTTP_POST_FILES or $_FILES if you are using a version of PHP that has super globals. See the PHP manual for more info: http://www.php.net/manual/en/language.variables.predefined.php - Original Message - From: "Chris Shiflett" <[EMAIL PROTECTED]> To: "Lee P. Reilly" <[EMAIL PROTECTED]>; "PHP" <[EMAIL PROTECTED]> Sent: Monday, December 16, 2002 10:04 AM Subject: Re: [PHP] $HTTP_POST_VARS problem > --- "Lee P. Reilly" <[EMAIL PROTECTED]> wrote: > > The following statements have the following return > > values: > > > > echo $HTTP_POST_VARS['userfile']; > > => C:\\Documents and Settings\\Administrator\\Desktop\\IR > > Files\\gmp1.ir > > > > echo $userfile; > > => C:\\Documents and Settings\\Administrator\\Desktop\\IR > > Files\\gmp1.ir > > > > echo $HTTP_POST_VARS['userfile']['name']; > > => NOTHING RETURNED > > > > echo $HTTP_POST_VARS['userfile']['size']; > > => NOTHING RETURNED > > > > echo $userfile_size; > > => NOTHING RETURNED > > > > echo $userfile_name; > > => NOTHING RETURNED > > > > Does anyone know what the problem is? > > What do you think the problem is? I don't see anything > unexpected, unless I'm missing something. > > Chris > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $HTTP_POST_VARS problem
Thanks for all the replies. However, I still have problems as the following code produces the following output: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= echo "0: " . $userfile . ""; echo "1: " . $HTTP_POST_FILES['userfile']['size'] . ""; echo "2: " . $HTTP_POST_FILES['userfile']['name'] . ""; echo "3: " . $HTTP_POST_FILES['userfile']['type'] . ""; echo "4: " . $HTTP_POST_FILES . " (" . sizeof($HTTP_POST_FILES) . ")"; echo "5: " . $HTTP_POST_FILES['userfile_size'] . ""; echo "6: " . $HTTP_POST_FILES['userfile']['type'] . ""; echo "7: " . $HTTP_POST_FILES['userfile_type'] . ""; echo "8: " . $usefile_type . ""; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 0: C:\\Documents and Settings\\Administrator\\Desktop\\IR Files\\gmp05.iR 1: 2: 3: 4: Array (0) 5: 6: 7: 8: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $HTTP_POST_VARS problem
--- "Lee P. Reilly" <[EMAIL PROTECTED]> wrote: > The following statements have the following return > values: > > echo $HTTP_POST_VARS['userfile']; > => C:\\Documents and Settings\\Administrator\\Desktop\\IR > Files\\gmp1.ir > > echo $userfile; > => C:\\Documents and Settings\\Administrator\\Desktop\\IR > Files\\gmp1.ir > > echo $HTTP_POST_VARS['userfile']['name']; > => NOTHING RETURNED > > echo $HTTP_POST_VARS['userfile']['size']; > => NOTHING RETURNED > > echo $userfile_size; > => NOTHING RETURNED > > echo $userfile_name; > => NOTHING RETURNED > > Does anyone know what the problem is? What do you think the problem is? I don't see anything unexpected, unless I'm missing something. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $HTTP_POST_VARS problem
Think you want $HTTP_POST_FILES rather than $HTTP_POST_VARS. As in $HTTP_POST_FILES['userfile']['name']; HTH, Richy == Richard Black Senior Developer, DataVisibility Ltd - http://www.datavisibility.com Tel: 0141 951 3481 Email: [EMAIL PROTECTED] "Lee P. Reilly" To: PHP <[EMAIL PROTECTED]> Subject: [PHP] $HTTP_POST_VARS problem 16/12/2002 15:48 Hi there, I'm currently using PHP 4.2.2 and I am have encountered some problems when trying to access $HTTP_POST_VARS. The following statements have the following return values: echo $HTTP_POST_VARS['userfile']; => C:\\Documents and Settings\\Administrator\\Desktop\\IR Files\\gmp1.ir echo $userfile; => C:\\Documents and Settings\\Administrator\\Desktop\\IR Files\\gmp1.ir echo $HTTP_POST_VARS['userfile']['name']; => NOTHING RETURNED echo $HTTP_POST_VARS['userfile']['size']; => NOTHING RETURNED echo $userfile_size; => NOTHING RETURNED echo $userfile_name; => NOTHING RETURNED Does anyone know what the problem is? I suspect that the '\\' in the path may have something to do with it. Thanks, Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This email has been scanned for all viruses by the MessageLabs SkyScan service. For more information on a proactive anti-virus service working around the clock, around the globe, visit http://www.messagelabs.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $HTTP_POST_VARS problem
On Monday 16 December 2002 23:48, Lee P. Reilly wrote: > Hi there, > > I'm currently using PHP 4.2.2 and I am have encountered some problems > when trying to access $HTTP_POST_VARS. The following statements have the > following return values: > > echo $HTTP_POST_VARS['userfile']; > => C:\\Documents and Settings\\Administrator\\Desktop\\IR Files\\gmp1.ir Better to use $_POST. > echo $userfile; > => C:\\Documents and Settings\\Administrator\\Desktop\\IR Files\\gmp1.ir > > echo $HTTP_POST_VARS['userfile']['name']; > => NOTHING RETURNED Use $_FILES. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* In a gathering of two or more people, when a lighted cigarette is placed in an ashtray, the smoke will waft into the face of the non-smoker. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP_POST_VARS Question
On Thursday, June 20, 2002, at 02:41 PM, Chris Sechiatano wrote: > Just a simple question about the HTTP_POST_VARS. I know my forms will > work > if I use only the name of the input. Say a text box called FirstName. > I > can just do: > > print "$FirstName"; > > and everything works fine. Why would I want to use > > print $HTTP_POST_VARS["FirstName"]; > > instead? Read the warning box at this page: http://www.php.net/manual/en/language.variables.predefined.php The short version: in PHP 4.1.2 or later you need to either use $_POST, $_GET, etc unless you set register_global = on (it is "off" by default). You don't really ever want to use $HTTP_POST_VARS, $HTTP_GET_VARS, etc unless you are using a version of PHP from before PHP 4.1.0. In which case you might want to use it in combination with turning register_globals = off, to help yourself avoid making bad coding mistakes. It's no substitute for good coding, but it can help. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $HTTP_POST_VARS vs _POST
On Monday, April 22, 2002, at 12:19 PM, [EMAIL PROTECTED] wrote: > HI ML > > Only one little question : > I know that _POST doesn't exists on php 4.0.6 but does $HTTP_POST_VARS > exist on php 4.1.2 ? Yes, but you would have had an answer to this question 45 minutes ago if you had just tried it. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $HTTP_POST_VARS
On Thu, 21 Mar 2002, Joshua E Minnie wrote: > I need to access a variable on a form that allows multiples. I have to use > $HTTP_POST_VARS so I need to know how to display the information obtained > from the form. This is what I am using right now: > >reset($HTTP_POST_VARS["interest"]); > while(current($HTTP_POST_VARS["interest"])) { > echo strip_tags(trim($HTTP_POST_VARS["interest"]))." "; > next($HTTP_POST_VARS["interest"])); > } > ?> > > Both $HTTP_POST_VARS["interest"] and $HTTP_POST_VARS["interest[]"] throw > errors. Any suggestions would be greatly appreciated. 1. Make sure you defined the form element in your HTML as "interest[]" and not "interest". 2. Test to see that it's an array before trying to run loop through it, because if the user doesn't select anything, you won't get an array, and therefore referring to to the variable as one would be an error. if (is_array($HTTP_POST_VARS['interest'])) foreach ($HTTP_POST_VARS['interest'] as $item) echo strip_tags(trim($item)) . ' '; miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $HTTP_POST_VARS
$interest = $HTTP_POST_VARS['interest']; or (if using PHP 4.1) $interest = $_POST['interest']; then reference $interest[0], $interest[1], $interest[2],... -Original Message- From: Joshua E Minnie [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 11:54 AM To: [EMAIL PROTECTED] Subject: [PHP] $HTTP_POST_VARS I need to access a variable on a form that allows multiples. I have to use $HTTP_POST_VARS so I need to know how to display the information obtained from the form. This is what I am using right now: Both $HTTP_POST_VARS["interest"] and $HTTP_POST_VARS["interest[]"] throw errors. Any suggestions would be greatly appreciated. -- Joshua E Minnie CIO [EMAIL PROTECTED] "Don't work for recognition, but always do work worthy of recognition." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] HTTP_POST_VARS problem
Make the name of the select an array e.g. http://www.chessish.com> -- From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]] Sent: 08 February 2002 02:47 To: [EMAIL PROTECTED] Subject: Re: [PHP] HTTP_POST_VARS problem Please ignore my question - I just figured it out. I had the method="post" in the input type="submit" tag rather than in the form tag. It works! However, if one has an HTML select/option menu scrolling list with multiple selections, how does one get the number of values for the same name with HTTP_POST_VARS? Or how does one scroll through the list of choices passed? Thanks, Eurico [EMAIL PROTECTED] wrote: > Hi. I'm a newbie at this and am having problems understanding how this > works. > > I have a form with method="post". The server program does display > REQUEST_STRING as I expect (e.g., choice=yes but displaying > HTTP_POST_VARS["choice"] is null). However, displaying > HTTP_GET_VARS["choice"] does display "yes". Running phpinfo() displays > that the REQUEST_METHOD = GET. Why is this GET and how do I get it set > to POST? How do I get HTTP_POST_VARS to work since my form does have > method="post"? > > Here are some php.ini settings (I'm running PHP 4.1.1 with Apache 1.3.22 > > under Win98): > > variables_order = "EGPCS" > register_globals = On > register_argc_argv = On > gpc_order = "GPC" > > Thanks... > > Eurico > [EMAIL PROTECTED] > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP_POST_VARS problem
Please ignore my question - I just figured it out. I had the method="post" in the input type="submit" tag rather than in the form tag. It works! However, if one has an HTML select/option menu scrolling list with multiple selections, how does one get the number of values for the same name with HTTP_POST_VARS? Or how does one scroll through the list of choices passed? Thanks, Eurico [EMAIL PROTECTED] wrote: > Hi. I'm a newbie at this and am having problems understanding how this > works. > > I have a form with method="post". The server program does display > REQUEST_STRING as I expect (e.g., choice=yes but displaying > HTTP_POST_VARS["choice"] is null). However, displaying > HTTP_GET_VARS["choice"] does display "yes". Running phpinfo() displays > that the REQUEST_METHOD = GET. Why is this GET and how do I get it set > to POST? How do I get HTTP_POST_VARS to work since my form does have > method="post"? > > Here are some php.ini settings (I'm running PHP 4.1.1 with Apache 1.3.22 > > under Win98): > > variables_order = "EGPCS" > register_globals = On > register_argc_argv = On > gpc_order = "GPC" > > Thanks... > > Eurico > [EMAIL PROTECTED] > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP_POST_VARS truncated
> reset($HTTP_POST_VARS); > > at the begining of the code. if that doesn't work verify your html again. > make sure the 's are between the form tag. php doesn't ignore > certain form fields. =) > > i'm the habit of reading arrays like... > while(list($k,$v) = each($HTTP_POST_VARS)) { > echo "key is $k - val is $v \n"; Thanks Jason I'll try it tonight, I'm not at my desk now. However, I would like to highlight that: 1) the select tags *are* inside the forms ones. I know php accepts all form fields, that's why I'm so puzzled... 2) I know that the code I posted here is wrong. In fact I said "something like..."; The code I put in the real PHP page however is correct, identical to what you write above, copied straight from a manual: the proof is that otherwise it would not have printed the other form fields as reported, right? Again, I'll try the reset instructino tonight and report. In the meantime any other hypothesis is welcome Thanks, mweb -- 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 truncated
Thanks Jason & Jani!Both ur ways work! $loc = "..\files\poese.txt" $loc = "..\\files\\poese.txt" But another question that comes to mind is that why must i include the '..\' to move down to a sub-directory? I thought '..\' moves up a directory tree! This also works both ways : $loc = "../files/poese.txt" $loc = "..//files//poese.txt" -Original Message- From: Jason [mailto:[EMAIL PROTECTED]] Sent: 30 November 2001 10:54 To: mweb; phplist Subject: Re: [PHP] HTTP_POST_VARS truncated try: reset($HTTP_POST_VARS); at the begining of the code. if that doesn't work verify your html again. make sure the 's are between the form tag. php doesn't ignore certain form fields. =) i'm the habit of reading arrays like... while(list($k,$v) = each($HTTP_POST_VARS)) { echo "key is $k - val is $v \n"; } > To test the http/php setup on one of my computers I wrote a > very simple html form, with two select fields, > two text fields, and the submit field. Pushing submit the > data are sent via POST method to an extremely simple PHP > page which only contains something like: > > foreach (var, key) in HTTP_POST_VARS { > > print "VAR: $var KEY = $key > } > > It works, (meaning that php code is correct, html output is displayed, > and no error are reported) but only prints three lines, i.e. the two select fields are missing. > Both the php and the html code are syntactically correct: I > double checked that on the books, just to be sure. > > It looks like the select fields, and them only, are not passed > to the form by the server, or that in some other way they never > make it into HTTP_POST_VARS. > > Any ideas? Setup is plain Red Hat 7.2 with its default apache/php > packages. > > TIA, > mweb > > > -- > 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 truncated
try: reset($HTTP_POST_VARS); at the begining of the code. if that doesn't work verify your html again. make sure the 's are between the form tag. php doesn't ignore certain form fields. =) i'm the habit of reading arrays like... while(list($k,$v) = each($HTTP_POST_VARS)) { echo "key is $k - val is $v \n"; } > To test the http/php setup on one of my computers I wrote a > very simple html form, with two select fields, > two text fields, and the submit field. Pushing submit the > data are sent via POST method to an extremely simple PHP > page which only contains something like: > > foreach (var, key) in HTTP_POST_VARS { > > print "VAR: $var KEY = $key > } > > It works, (meaning that php code is correct, html output is displayed, > and no error are reported) but only prints three lines, i.e. the two select fields are missing. > Both the php and the html code are syntactically correct: I > double checked that on the books, just to be sure. > > It looks like the select fields, and them only, are not passed > to the form by the server, or that in some other way they never > make it into HTTP_POST_VARS. > > Any ideas? Setup is plain Red Hat 7.2 with its default apache/php > packages. > > TIA, > mweb > > > -- > 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 truncated
I cannot compile this: try that : foreach ($HTTP_POST_VARS as $key => $var){ print "VAR: $var KEY = $key"; } Regards, Andrey Hristov - Original Message - From: "mweb" <[EMAIL PROTECTED]> To: "phplist" <[EMAIL PROTECTED]> Sent: Friday, November 30, 2001 10:03 AM Subject: [PHP] HTTP_POST_VARS truncated Hello, To test the http/php setup on one of my computers I wrote a very simple html form, with two select fields, two text fields, and the submit field. Pushing submit the data are sent via POST method to an extremely simple PHP page which only contains something like: foreach (var, key) in HTTP_POST_VARS { print "VAR: $var KEY = $key } It works, (meaning that php code is correct, html output is displayed, and no error are reported) but only prints three lines, i.e. the two select fields are missing. Both the php and the html code are syntactically correct: I double checked that on the books, just to be sure. It looks like the select fields, and them only, are not passed to the form by the server, or that in some other way they never make it into HTTP_POST_VARS. Any ideas? Setup is plain Red Hat 7.2 with its default apache/php packages. TIA, mweb -- 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, forms, and not allowing modifications.
On Mon, 26 Nov 2001, Martin Towell wrote: > you said you tried a text field, have you tried a hidden field? Alrighty then, my greenness shows. :) The hidden field idea was perfect (never used one before). Thank god I'm just playing around with my _own_ site. ;) Thanks Martin! Benny ~~ "The onions are irritating my buttocks." - Sluggy Freelance 10-12-1998 -- 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, forms, and not allowing modifications.
you said you tried a text field, have you tried a hidden field? does it HAVE to be in $HTTP_POST_VARS ?? can you append it to whatever link you have using "?unique_id=$id" or something similar? Martin T -Original Message- From: C. Bensend [mailto:[EMAIL PROTECTED]] Sent: Monday, November 26, 2001 8:18 AM To: [EMAIL PROTECTED] Subject: [PHP] HTTP_POST_VARS, forms, and not allowing modifications. Hey folks, I am working on a database-driven site, and have run into a problem. It's not a problem with any existing code, more of a "how the heck do I do this" sort of thing. I have a table, that is generated from a database query: +---+---++-+ | unique_id | some_text | some_more_text | edit button | +---+---++-+ The unique_id is an integer, and the user can NOT be allowed to modify it. However, I need to pass that value to the php script that's the ACTION for the "edit button". register_globals is not allowed, so somehow I need to get the value of unique_id into the HTTP_POST_VARS array. I tried: $HTTP_POST_VARS['unique_id'] = id; but it was ignored. I know I can make the unique_id a TEXT input area, but then it can be modified. I did some searching around for more information about what can and can not be done with HTTP_POST_VARS, but I didn't find anything helpful (I could have been looking in the wrong place, too). Anyone have some Wise Tips(tm) for me? Any help would be greatly appreciated. :) Benny ~~ "The onions are irritating my buttocks." - Sluggy Freelance 10-12-1998 -- 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) Whatdo "; $row++; endwhile; else: ?> Row Options Load Delete Change Category -- 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
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 > > > > Load > Delete > Change Category > > > > > 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 > > > > > > > > >checked> > > Load > > >value="delete"> > > Delete > > >value="change"> > > Change Category > > > >. > >. > >. > > > >- > >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[]" 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
Just an addendum, I changed it from radio buttons to a pop up menu Load Delete Change Category 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 > > > > checked> > Load > value="delete"> > Delete > value="change"> > Change Category > >. >. >. > >- >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[]" 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
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 Load Delete Change Category . . . - 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[]" 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
Hi Your whatdo's will be whatdo0 whatdo1...whatdox You need to do like this if I understand what you are doing :) $row=0; while($row < $numofrows): $var = "whatdo".$row; $whatdo = $submitted_vars["$var"]; //do whatever with $whatdo . $row ++; endwhile; Tom 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[]" 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]
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[]" 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]
Re: [PHP] $HTTP_POST_VARS
something like this... if( sizeof( $HTTP_POST_VARS ) > 0 ){ // avoid error when no vars while ( list ( $key, $val ) = each ( $HTTP_POST_VARS )) { print "$key = $val"; } } py - Original Message - From: "Andy Ladouceur" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, August 27, 2001 9:48 PM Subject: [PHP] $HTTP_POST_VARS > Hello all, > I am wondering if there is a command or function to get a list of all the > current '$HTTP_POST_VARS["variable"]' variables? Or, a user-created way... > Any helps appreciated, thanks! > -Andy L. > > > > -- > 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
Thanks! -Andy Jason Murray <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I am wondering if there is a command or function to get a > > list of all the current '$HTTP_POST_VARS["variable"]' variables? > > Or, a user-created way... Any helps appreciated, thanks! > > You can use var_dump($HTTP_POST_VARS); > > Jason -- 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
Ah, its that simple? -feels likea bit of an idiot- Thanks for the help! Tim <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > while (list($k,$v) = each($HTTP_POST_VARS)) { > echo "$k = $v"; > } > > On Mon, 2001-08-27 at 21:48, Andy Ladouceur wrote: > > Hello all, > > I am wondering if there is a command or function to get a list of all the > > current '$HTTP_POST_VARS["variable"]' variables? Or, a user-created way... > > Any helps appreciated, thanks! > > -Andy L. > > > > > > > > -- 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
> I am wondering if there is a command or function to get a > list of all the current '$HTTP_POST_VARS["variable"]' variables? > Or, a user-created way... Any helps appreciated, thanks! You can use var_dump($HTTP_POST_VARS); Jason -- 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
while (list($k,$v) = each($HTTP_POST_VARS)) { echo "$k = $v"; } On Mon, 2001-08-27 at 21:48, Andy Ladouceur wrote: > Hello all, > I am wondering if there is a command or function to get a list of all the > current '$HTTP_POST_VARS["variable"]' variables? Or, a user-created way... > Any helps appreciated, thanks! > -Andy L. > > > -- 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 not picking up checkboxes that are unchecked
"Tom Beidler" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have a form with approximately 40 input fields. When a form is posted it > sends an email and then builds a tab delimited $txt entry for a text file on > the server. > > The problem is that if a checkbox is not checked, when it's not required, I > don't get a blank entry in my tab file for the checkbox input. I'm imploding (snip)> > Is there a way to send a blank value if the checkbox is not set? Should I > use a completely different strategy? Have I said Thank you enough to Rasmus > Lerdorf and whomever else was involved in resuscitating the list? > I've had a similar project kicking about in my head, and this post finally got me to try a few things. The idea I had was for a "multi-questionnaire" system, where surveys are created from a database query, scored by a common marking script, and the results stored back to the database. Obviously, the marking script can't know what inputs to expect... My first idea was to create a parseable "variable-names-to-look-for" variable, but that seemed unwieldy. Then I recalled someone complaining about not being able to retrieve multiple input fields with the same name - they only get the last ie most recent field set. ;-) and there's the answer. If you have a hidden input with the same name and a default value _before_ your checkbox input, then your checkbox will over-write it if it's checked; otherwise you receive the default value! ie if the checkbox is checked, $myvariable = "Yes", otherwise $myvariable = "No" - exactly what you were looking for. Better yet, because $myvariable only occurs once among the POSTed variables, you can simply iterate through them, ie foreach($HTTP_POST_VARS as $name => $val) $outstr .= "$name: $val"; See the attached file, 'test.php', for a simply demo. begin 666 test.php M/#]P:' *"21S='(@/2 B(CL*"69O7!E/2)H:61D96XB(&YA;64](F)L M=65G65S;F\B('9A;'5E/2). M;R(^"@D)"0D\=&0^/&EN<'5T('1Y<&4](F-H96-K8F]X(B!N86UE/2)Y97-N M;R(@=F%L=64](EEEhttp://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 not picking up checkboxes that areunchecked
The thing can do is as follows: When i want check such empty boxes, i call up the $HTTP_POST_VARS just like you. BUT what i do next ist that while listing those vars i insert an if statement like if (!strstr($key,checkbox_name)) {echo ($error);} So i do a stringmatch with the key and the name... this way you can check all checkboxes if the have generic starting like check_01 check_02 so then you just ask if (!strstr($key,chec)) {echo ($error);} For strstr function see the manual if you dont know. Another way is as follows... And its probably the best!. You can start putting checkbox values into an array... like this " value="bla"> cb_ then represents the array and THIS array gets transported within the $HTTP_POST_VARS or rather exists as long as the page is up or reloaded. Inside the listing of $HTTP_POST_VARS you then just do another array listing for the cb_ array like this: while (list($key, $val) = each($HTTP_POST_VARS)) { if (strstr($key,'cb_')) { $v_ok=1; while (list($key, $val) = each($cb_)) { $v_liste.=' '.$val; $v_user_liste = eregi_replace("$val","",$user_liste); } } } The only backdrop is that you would have to initilaize those array elements with an '' before Works very nicely for me though.. since most checkbox elements are groups and get pulled out of a database. So the initializing is generic too ;) Maybe this helps, regards Jens on 19.06.2001 1:46 Uhr, Tom Beidler at [EMAIL PROTECTED] wrote: > I have a form with approximately 40 input fields. When a form is posted it > sends an email and then builds a tab delimited $txt entry for a text file on > the server. > > The problem is that if a checkbox is not checked, when it's not required, I > don't get a blank entry in my tab file for the checkbox input. I'm imploding > my HTTP_POST_VARS variable like so; > > reset($HTTP_POST_VARS); > while (list($var, $value) = each($HTTP_POST_VARS)) { > if (is_array($value)){ > $txt .= implode($value, "\t"); > $txt .= "\t"; > } > else{ > $txt .= "$value\t"; > } > } > $txt .= "end\n"; > $flsfile = fopen("text/fls.txt", "a"); > if ($flsfile){ > fputs($flsfile, "$txt"); > fclose($flsfile); > } > > Is there a way to send a blank value if the checkbox is not set? Should I > use a completely different strategy? Have I said Thank you enough to Rasmus > Lerdorf and whomever else was involved in resuscitating the list? > > Thanks Rasmus Lerdorf and all others involved for getting the list back up > and running. > > >>> .>>.>>>.>.>. > Tom Beidler > Orbit Tech Services > 805.682.8972 (phone) > 805.682.5833 (fax) > [EMAIL PROTECTED] > http://www.orbittechservices.com/ >>> .>>.>>>.>.>. > >
RE: [PHP] HTTP_POST_VARS not picking up checkboxes that are unche cked
This is how i get around it. On the form page: On the submission page: if (empty($SUBSCRIBE)) { $SUBSCRIBE = "NO"; } hth, quinn merio www.vr2a.com -Original Message- From: John Monfort [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 19, 2001 6:20 AM To: Jason Murray Cc: 'Tom Beidler'; [EMAIL PROTECTED] Subject: RE: [PHP] HTTP_POST_VARS not picking up checkboxes that are unche cked I had some issues with that recently. It turns out that PHP will not pick up the checkboxes, unless you use the GET method. You can then access your vars with HTTP_GET_VARS. This was discovered on WIN98+ PHP 4.03pl1 + Apache 1.3++ & WIN ME + PHP 4.03pl1 + Apache 1.3++ If someone had a different experience, then I would like to hear about it. Please share. __John Monfort_ _+---+_ P E P I E D E S I G N S www.pepiedesigns.com "The world is waiting, are you ready?" -+___+- On Tue, 19 Jun 2001, Jason Murray wrote: > > Subject: [PHP] HTTP_POST_VARS not picking up checkboxes that are unchecked > > That's right - if the checkbox isn't checked the browser doesn't send it. > > Jason >
RE: [PHP] HTTP_POST_VARS not picking up checkboxes that are unchecked
I had some issues with that recently. It turns out that PHP will not pick up the checkboxes, unless you use the GET method. You can then access your vars with HTTP_GET_VARS. This was discovered on WIN98+ PHP 4.03pl1 + Apache 1.3++ & WIN ME + PHP 4.03pl1 + Apache 1.3++ If someone had a different experience, then I would like to hear about it. Please share. __John Monfort_ _+---+_ P E P I E D E S I G N S www.pepiedesigns.com "The world is waiting, are you ready?" -+___+- On Tue, 19 Jun 2001, Jason Murray wrote: > > Subject: [PHP] HTTP_POST_VARS not picking up checkboxes that are unchecked > > That's right - if the checkbox isn't checked the browser doesn't send it. > > Jason >
Re: [PHP] HTTP_POST_VARS not picking up checkboxes that are unchecked
> The problem is that if a checkbox is not checked, when it's not required, I > don't get a blank entry in my tab file for the checkbox input. I'm imploding > my HTTP_POST_VARS variable like so; This has nothing to do with PHP. Your browser sends nothing for an unchecked checkbox. You would have to work around this either by knowing in your code the complete list of checkboxes, or perhaps adding hidden fields in your HTML. -Rasmus
RE: [PHP] HTTP_POST_VARS not picking up checkboxes that are unchecked
> Subject: [PHP] HTTP_POST_VARS not picking up checkboxes that are unchecked That's right - if the checkbox isn't checked the browser doesn't send it. Jason
Re: [PHP] HTTP_POST_VARS variable names?
Quick answer: HTTP_POST_VARS is an associative array. The "name" of the submitted variables are the keys, and the value of the element is the value that was submitted. -- Plutarck Should be working on something... ...but forgot what it was. ""Mat Marlow"" <[EMAIL PROTECTED]> wrote in message 9bk11q$dvq$[EMAIL PROTECTED]">news:9bk11q$dvq$[EMAIL PROTECTED]... > Hi, > Does anyone know if php stores POST variable names as well as values? I'm > using HTTP_POST_VARS for the values but I'm having to create my own array > for the names. > > cheers, > > Mat > > > > -- > 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 variable names?
Mat Marlow wrote: > > Hi, > Does anyone know if php stores POST variable names as well as values? I'm > using HTTP_POST_VARS for the values but I'm having to create my own array > for the names. > > cheers, > > Mat > > -- > 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] Correct me if I misunderstand you're question, but; If you use HTTP_POST_VARS you already have the variable names. I mean... how else do you use the values you're talking about? $HTTP_POST_VARS{"var_1"}, $HTTP_POST_VARS{"var_2"}, etc. var_1 and var_2 are the variable names... -- * R&zE: *** ** Renze Munnik ** ** E: [EMAIL PROTECTED] ** M: +31 6 218 111 43 *** -- 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 variable names?
Hi, this will list all your posted variables with name and the posted value. while (list($key, $value)=each($HTTP_POST_VARS) ) { echo "$key = $value "; } Johannes ""Mat Marlow"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 9bk11q$dvq$[EMAIL PROTECTED]">news:9bk11q$dvq$[EMAIL PROTECTED]... > Hi, > Does anyone know if php stores POST variable names as well as values? I'm > using HTTP_POST_VARS for the values but I'm having to create my own array > for the names. > > cheers, > > Mat > > > > -- > 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 not and array when used in a function?
So sprach Joseph Blythe am Wed, Apr 18, 2001 at 10:48:14AM +0930: > Hey, > > Why doesn't HTTP_POST_VARS work inside functions? > > ---somefile.php - forms action --- > > function foo() { >reset($HTTP_POST_VARS); Because this particular HTTP_POST_VARS is not the HTTP_POST_VARS you have outside the function. Either you pass it along as a parameter, or you do: global $HTTP_POST_VARS; Alexander Skwar -- How to quote: http://learn.to/quote (german) http://quote.6x.to (english) Homepage: http://www.digitalprojects.com | http://www.iso-top.de iso-top.de - Die günstige Art an Linux Distributionen zu kommen Uptime: 1 day 10 hours 18 minutes -- 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 not and array when used in a function?
Rasmus Lerdorf wrote: > It is a normal global variable. Like all other global variables you need > to declare the fact that you want the global variable inside a function. > Simply put: global $HTTP_POST_VARS; at the top of your function and it > will work just fine. > > Read the section on variable scope in the PHP documentation. Thanks Rasmus, I should really be tarred and feathered eh :-) Joseph -- 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 not and array when used in a function?
> I thought the above would work but it returns the following error(s): > > ... value passed to reset is not an array or object ... > ... value passed to each is not an array or object ... > > It seems that HTTP_POST_VARS does not like being called from inside > functions, as the above will work if not inside the function, I thought > that HTTP_POST_VARS was in the global scope (as of php 4.0.3 track-vars > is always on) , so it should have no problem being called from anywhere? > > Does anyone know what gives? It is a normal global variable. Like all other global variables you need to declare the fact that you want the global variable inside a function. Simply put: global $HTTP_POST_VARS; at the top of your function and it will work just fine. Read the section on variable scope in the PHP documentation. -Rasmus -- 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
At 4:50 PM +0200 4/12/01, Dominick Vansevenant <[EMAIL PROTECTED]> wrote: >Mat, > >did you put in a reset? > >reset($HTTP_POST_VARS); > >D. Yes, you'll need the reset() there if you're looping through the $HTTP_POST_VARS array more than once. However: I take it that you were trying something like echo $HTTP_POST_VARS[0]; ? If so, you will indeed get the output 'array' if element 0 is an array. As someone suggested, you can use the print_r() or var_dump() functions (print_r, I think, is PHP4 only) to display it. You can also do something like ... if (is_array($HTTP_POST_VARS[0])) { while (list($k,$v)=each($HTTP_POST_VARS[0])) { echo '$HTTP_POST_VARS[0]', "[$k] = $v"; } } else { echo '$HTTP_POST_VARS[0] = ', $HTTP_POST_VARS[0]; } ... In PHP3, POST/GET elements could only be one dimensional arrays, at most. In PHP4, though, these can have 2+ dimensions, so for maximum generality you'd have to have somewhat more complex code than this. -steve >-Original Message- >From: Mat Marlow [mailto:[EMAIL PROTECTED]] >Sent: donderdag 12 april 2001 16:49 >To: [EMAIL PROTECTED] >Subject: [PHP] HTTP_POST_VARS > > >Hi all, >I'm having trouble retrieving data from $HTTP_POST_VARS. Whenever I try to >print something from it using print($HTTP_POST_VARS[0]); it just prints >"Array". And I know it works because I've done it once and can't do it >again! >Am I missing something glaringly obvious? > >Thanks for the help, > >Mat >PS. track_vars is ON! > -- +--- 12 April 2001: Forty years of manned spaceflight ---+ | Steve Edberg University of California, Davis | | [EMAIL PROTECTED] Computer Consultant | | http://aesric.ucdavis.edu/ http://pgfsun.ucdavis.edu/ | +-- www.yurisnight.net --+ -- 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
Try doing a print_r in the place where you are trying to print data. So you can see if a second dimension slipped in there, or if there is some other problem. I know that the post/get vars are always associative arrays, but I assume refering to them by their numeric keys should work...don't see why it wouldn't. -- Plutarck Should be working on something... ...but forgot what it was. ""Mat Marlow"" <[EMAIL PROTECTED]> wrote in message 9b4f3s$3uo$[EMAIL PROTECTED]">news:9b4f3s$3uo$[EMAIL PROTECTED]... > Hi all, > I'm having trouble retrieving data from $HTTP_POST_VARS. Whenever I try to > print something from it using print($HTTP_POST_VARS[0]); it just prints > "Array". And I know it works because I've done it once and can't do it > again! > Am I missing something glaringly obvious? > > Thanks for the help, > > Mat > PS. track_vars is ON! > > > > -- > 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
Mat, did you put in a reset? reset($HTTP_POST_VARS); D. -Original Message- From: Mat Marlow [mailto:[EMAIL PROTECTED]] Sent: donderdag 12 april 2001 16:49 To: [EMAIL PROTECTED] Subject: [PHP] HTTP_POST_VARS Hi all, I'm having trouble retrieving data from $HTTP_POST_VARS. Whenever I try to print something from it using print($HTTP_POST_VARS[0]); it just prints "Array". And I know it works because I've done it once and can't do it again! Am I missing something glaringly obvious? Thanks for the help, Mat PS. track_vars is ON! -- 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
Check your browser settings, I had this problem when I had the 'check page never' setting selected, and it went away when I set it to 'check every session' >I am having a similar problem as the original poster. In my case, I _want_ >the second sumbission to overwrite the first, but it's not happening. What >I have is a radio button list all named="update" each with it's own value >(ie. 2,3,4,5,etc.). The form is self-submitting and tests on 'update' to >know how to proceed. What I'm experiencing is that after the first >submission, printing out '$HTTP_POST_VARS' array gives the correct update >value. Subsequent submissions also show this same value no matter what >value is selected in the form. -- 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
I am having a similar problem as the original poster. In my case, I _want_ the second sumbission to overwrite the first, but it's not happening. What I have is a radio button list all named="update" each with it's own value (ie. 2,3,4,5,etc.). The form is self-submitting and tests on 'update' to know how to proceed. What I'm experiencing is that after the first submission, printing out '$HTTP_POST_VARS' array gives the correct update value. Subsequent submissions also show this same value no matter what value is selected in the form. I've tried using 'unset($HTTP_POST_VARS[update]);' at the end of the script after the var has been used and reprintingg the HTTP_POST_VARS array which shows that it was unset, but on resubmission of the form, it reappears! losing hair, David Minor on 3/8/01 5:45 PM, [EMAIL PROTECTED] at [EMAIL PROTECTED] wrote: > Explained here: > http://www.php.net/manual/en/language.variables.external.php > > Basically name the variables with []. For example: > > > > In your example, the second is actually overwriting the first. > > > Nate > > -Original Message- > From: mat t [mailto:[EMAIL PROTECTED]] > Sent: Thursday, March 08, 2001 3:10 PM > To: [EMAIL PROTECTED] > Subject: [PHP] $HTTP_POST_VARS > > > Please can you help: > > I can't send duplicate input types to $HTTP_POST_VARS > For example: > ---HTML--- > First person: > > NAME > > > Phone No. > > > Second Person: > > NAME > > > Phone No. > > > --- > > Then when I use : > > reset ($HTTP_POST_VARS); > while (list ($key, $val) = each ($HTTP_POST_VARS)) > { > echo "$key => $val\n"; > } > > Here is the output > > Output-- > > Name => > Name_type => textbox > Phone => > Phone_type => textbox > > > > What happened to the Second person? > How can I stop it ignoring duplicates and insert in the array 1 by 1? > -- 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
No. Check box and radio buttons are not set, though. Regards, -- Yasuo Ohgaki ""stas"" <[EMAIL PROTECTED]> wrote in message 026001c07cc4$aeaa6250$9701a8c0@snewdel">news:026001c07cc4$aeaa6250$9701a8c0@snewdel... Hello, Is it that correct that only non-empty variables get inserted into HTTP_POST_VARS? I am trying to do server side form validations, and this represents a bit of difficulty in terms of notifying a user about which fields are missing values. -- 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
Explained here: http://www.php.net/manual/en/language.variables.external.php Basically name the variables with []. For example: In your example, the second is actually overwriting the first. Nate -Original Message- From: mat t [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 08, 2001 3:10 PM To: [EMAIL PROTECTED] Subject: [PHP] $HTTP_POST_VARS Please can you help: I can't send duplicate input types to $HTTP_POST_VARS For example: ---HTML--- First person: NAME Phone No. Second Person: NAME Phone No. --- Then when I use : reset ($HTTP_POST_VARS); while (list ($key, $val) = each ($HTTP_POST_VARS)) { echo "$key => $val\n"; } Here is the output Output-- Name => Name_type => textbox Phone => Phone_type => textbox What happened to the Second person? How can I stop it ignoring duplicates and insert in the array 1 by 1? _ Pick up your email anywhere in the world ---> http://www.remail.net -- 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
You're not setting a value for the first variable ie.."Name" unless you put something in the text box to represent the variable it will come across as empty. Jerry Lake- [EMAIL PROTECTED] Web Designer Europa Communications - http://www.europa.com Pacifier Online - http://www.pacifier.com -Original Message- From: mat t [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 08, 2001 2:10 PM To: [EMAIL PROTECTED] Subject: [PHP] $HTTP_POST_VARS Please can you help: I can't send duplicate input types to $HTTP_POST_VARS For example: ---HTML--- First person: NAME Phone No. Second Person: NAME Phone No. --- Then when I use : reset ($HTTP_POST_VARS); while (list ($key, $val) = each ($HTTP_POST_VARS)) { echo "$key => $val\n"; } Here is the output Output-- Name => Name_type => textbox Phone => Phone_type => textbox What happened to the Second person? How can I stop it ignoring duplicates and insert in the array 1 by 1? _ Pick up your email anywhere in the world ---> http://www.remail.net -- 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
http://php.net/FAQ.php talks about HTTP_POST_VARS a little... -- Visit the Zend Store at http://www.zend.com/store/ Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm - Original Message - From: Augusto Cesar Castoldi <[EMAIL PROTECTED]> Newsgroups: php.general Sent: Thursday, February 15, 2001 1:44 PM Subject: [PHP] $HTTP_POST_VARS >reset($HTTP_POST_VARS); >while (list($key, $val) = each($HTTP_POST_VARS)) { > file://print "$key - $val"; > if (substr($key,0,3) == "alt" or substr($key,0,3) == "exc") > > > Somebody can explain or indicate any site about this ($HTTP_POST_VARS)? > > It is used to do menu in php. If the name of the button ( type="image" name="back"...> > > then in php I use: > > if ($back_x > 0) { > . > . > . > } > > Augusto Cesar Castoldi > > > -- > 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]