Re: Retrieving the multiple values set by a form



Ron Barnett wrote:
In the example you have given, which equates to a Get, the variables will
indeed overwrite each other with only the last value surviving, as stated by
lorento.


Hi Ron and everyone else,

Thanks for your response. Let me expand a bit on my requirement. I have
a dynamically generated form where I am now trying something similiar.
To wit:

<input name='inp[0]' type='checkbox' value='first value'>
<input name='inp[1]' type='checkbox' value='second value'>
<input name='inp[2]' type='checkbox' value='third value'>
..
..
etc

Basically, I present a user with a dynamically generated checklist and
I am trying to see all the values that he has checked.


once this is received by your PHP script the values may be retrieved :

$myArray = $_REQUEST('ip'); // note no subscripts required

$myArray['0'] will contain 'first value', $myArray['1'] the second value,
and so on


Doing as you have suggested, count($myArray) gives the correct number
of values ticked.

But only $myArray['0'] is set!
$myArray['1'], $myArray['2'] , ..., etc are not set!

Not to flame or anything, I AM quite surprised by how arcane processing
a checklist in php is turning out to be. :-)


Thanks again!
Girish

.



Relevant Pages

  • Re: Retrieving the multiple values set by a form
    ... indeed overwrite each other with only the last value surviving, ... lorento. ... Thanks for your response. ... Let me expand a bit on my requirement. ...
    (comp.lang.php)
  • XMLHTTPRequest method POST appears not to be sent
    ... I have a an Ajax post sent to a php script on the server...the script ... returns a response indicating that the _POST array wasn't set. ... var url = "http:///process_xhr.php"; ... } catch (err) { ...
    (comp.lang.javascript)
  • Re: xmlHttpRequest gives no response
    ... CreateXmlHttp is a general, browser independent function I always use ... it does give the expected response. ... passing back a hardcoded response from the php script. ... and make sure you echo the response and don't 'return' it. ...
    (comp.lang.javascript)
  • Re: Message box
    ... PHP script runs on the server side, there is no way to bring up a message box on the client machine from within PHP script. ... If you want to do something, then ask something of user, and proceed depending on what the response was, one way to do that would be to have ... javascript populates the form with the response and submits form ... if login ok, redirect somewhere ...
    (comp.lang.php)
  • BASIC to HTTP
    ... I want to invoke a PHP script on the server direct from a BASIC program ... So I might want the PHP script to, let's say, delete an entry in a MySQL ... What I don't want is a browser window opening in response, ... kell at mighty dot me dot uk ...
    (comp.sys.acorn.programmer)