Re: sending an array through post
| From: | Nicole Amashta | Date: | Tue, 15 Jan 2002 20:12:00 +0000 |
| Subject: | Re: sending an array through post | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-11461@lists.php.net to get a copy of this message | ||
Do you want to set the field with the values from a PHP array? Or do you
want to retrieve back as an array values from a form?
If the first, you must walk through the array and print the values out;
If the latter, you can use a list box and assign it some name and include
brackets to make it an array when returned back to the php script.
Example:
<form action="somescript.php" method="post" >
<input type="checkbox" name="id[]" value="1">
<input type="checkbox" name="id[]" value="2">
.....
<input type="checkbox" name="id[]" value="n">
</form>
Then, once the php script is called, you can access the values checked off
and loop through the id[] array. Values checked on the form will be returned
in the array $id.
for($i=0; $i<count($id); $i++) {
echo $id[$i]; /// prints out the id's
}
Nicole Amashta
www.aeontrek.com
===================
"Polleke" <info@wwwdesign.tmfweb.nl> wrote in message
news:002101c19d38$43e030e0$7214643e@nieuwe...
Hello,
I need to send a lot of numbers with a form(post). How can I do that. I've
tried just this:
<input type="text" value="<?php $myArray ?>">
But that won't work.
How then?
polleke