Re: Retrieving the multiple values set by a form



I have to wonder why you're using GET at all for form submission. If
you used post, you could just pass in an array:

<form method="POST" action="somesecript.php">
<input type="text" name="values[]"/>
<input type="text" name="values[]"/>
</form>

And in the processing:

foreach ($_POST["values"]):

// do something with each value

endforeach;

~A!


lorento wrote:
Girish wrote:

http://xxxx/get_variables.php?form_variable=value1&form_variable=value2&form_variable=variable

Above request will be read by php like this:
$_REQUEST["form_variable"] = "value1";
$_REQUEST["form_variable"] = "value2";
$_REQUEST["form_variable"] = "value3";

so only the last value will be the result. Because the first will be
replaced with second value and second value will be replace with the
last value. I think its better you use different variable name.

http://xxxx/get_variables.php?form_variable1=value1&form_variable2=value2&form_variable3=variable
You can get all the values of above variables.

---
http://www.theukmap.com
http://www.theaussiemap.com

.



Relevant Pages

  • Re: Opinions? Is it _GOOD_ that foreach() throws warning when given undef var?
    ... > programing to supply an argument which is not an array, ... If I wanted to request PHP behavior to change, ... NOT be replying to you - I'd be posting my request to PHP developers ...
    (comp.lang.php)
  • Re: Query string before parsing
    ... software generator which creates multiple checkboxes using the same ... If the package is supposed to produce markup that sends a request to ... PHP handles correctly formatted post data, ... suddenly would return an array without warning, ...
    (comp.lang.php)
  • Re: Try to get a file from a server by PHP
    ... > print it or put it in an array, the problem in headers I can't figure ... > Your browser sent a request that this server could not understand. ... > Request header field is missing colon separator. ...
    (comp.lang.php)
  • Re: Getting data from a web page
    ... I'm using php 4.4.4. ... type this URL into my browser: ... request this URL and then put the return values ... into an array. ...
    (comp.lang.php)
  • Getting data from a web page
    ... I'm using php 4.4.4. ... type this URL into my browser: ... request this URL and then put the return values ... into an array. ...
    (comp.lang.php)