Re: Problems with HTTP_POST_VARS

From: Date: Fri, 24 Nov 2000 20:36:14 +0000
Subject: Re: Problems with HTTP_POST_VARS
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-27019@lists.php.net to get a copy of this message
<form action=test.php method=get> <input type=text name=data value="one"> <input type=text name=data value="two"> <input type=text name=data value="three"> <input type=submit> </FORM> ------------ test.php : <? while (list($name,$value)=each($HTTP_GET_VARS)){ print "$name = $value<BR>\n"; } ?> -------- output: data = three -------- read(STDIN, $buffer, $ENV{"CONTENT_LENGTH"}) your perl can't work with method get! The content isonly parsed via STDIN with method POST. But: watch the PHP-variable $QUERY_STRING! data=one&data=two&data=three regards Folke On Fri, 24 Nov 2000, Ignacio Vazquez-Abrams wrote: > On Fri, 24 Nov 2000, Rafael Steil wrote: > > > Hi. > > For example: > > my form have 3 fields: > > > > <inpu type=checkbox name=data value=one> > > <inpu type=checkbox name=data value=two> > > <inpu type=checkbox name=data value=four> > > > > well, when user click on Submit button, I only can get the value of the last chekbox > > checked./... and the others values, how I can retrieve it??? > > > > I use the following code: > > > > foreach($HTTP_POST_VARS as $data) > > echo "$data<br>"; > > > > ( ok, ok.. is bad, but is a example.. :) > > > > In Perl, its possible to use the read() function > > > > read(STDIN, $buffer, $ENV{"CONTENT_LENGTH"}) > > > > buth I've some problens to implement it with PHP ( fopen("php://stdin") > > crash ) > > > > Can someone help-me???? > > > > Rafael Steil > > > > Try: > > <input type=checkbox name=data1 value=one> > <input type=checkbox name=data2 value=two> > <input type=checkbox name=data3 value=four> > > And: > > for ($i=1; $i<=3; ++$i) > { > if (isset(${"data".$i})) > print ${"data".$i}; > }; > >

« previous php.general (#27019) next »