Title: RE: [PHP-DEV] Passing PHP Arrays as type "hidden" in a HTML Form

Do it like this:

$status = array( 0, 1 )

echo "<input type=\"hidden\" name=\"oldStatus\" value=\"$status[]></input>";

Then access the array through the name... oldStatus here...




Thank you,

Ray Hunter
Firmware Engineer

ENTERASYS NETWORKS


-----Original Message-----
From: Surya Saraff [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 12, 2002 10:07 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP-DEV] Passing PHP Arrays as type "hidden" in a HTML Form


Hi,

I had tried it, it doesnt work.
in t1.php:

echo $a; //give me "Array"
echo $a[1] //gives me "A"
echo $a[2] //gives me "r" and so on...

$a just gets the value "Array", but not the elements.

Any suggestions?

thanks,
surya


--- "Hunter, Ray" <[EMAIL PROTECTED]> wrote:
> Yes that is possible...
>
>
>
> Thank you,
>
> Ray Hunter
> Firmware Engineer
>
> ENTERASYS NETWORKS
>
>
> -----Original Message-----
> From: Surya Saraff [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, March 12, 2002 9:48 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DEV] Passing PHP Arrays as type
> "hidden" in a HTML Form
>
>
> Hi,
>
> I am trying to pass an array with hidden type and
> access it by value.
>
> for eg:
>
> IN t.php
>
> <?php
>   $a = array(1, 2, 3, 4, 5);
>   print ("<form action =\"t1.php\" method = post
> >");
>   print("<input type = hidden name =\"_a\" value =$a
> >");
>   print("<input type =submit value=submit>");
>   print("</form>");
> ?>
>
> IN t1.php (the page i am calling)
>
> <?php
> $a = $HTTP_POST_VARS["_a"];
> echo $a[1];  //i want "2" to be printed here, since
> $a[0]=1, $a[1] =2  --- is it possible?
> ?>
>
>
> Any suggestions as to how can I pass the value of
> the
> array through an HTML form, would be a great help!
>
> Thanks,
> Surya
>
> __________________________________________________
> Do You Yahoo!?
> Try FREE Yahoo! Mail - the world's greatest free
> email!
> http://mail.yahoo.com/
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php
>


__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

Reply via email to