Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to pass the 2-dimension parameter in form?

Status
Not open for further replies.

alan123

MIS
Joined
Oct 17, 2002
Messages
149
Location
US
In php file, I try to pass parameters in form from file php1 to file php2, I can use the following method to pass 1-dimension parameter:
php1 file:
=======
print &quot;<input type=hidden name=para[0] value=123>&quot;;
=======

php2 file:
=======
$v_val=$_POST['para'];
print &quot;$v_val[0]&quot;;
=======


It works fine, now if I want to pass 2-dimension parameter from php1 file, I tried:
php1 file:
======
print &quot;<input type=hidden name=para[0][0] value=123>&quot;;
=======
and php2 file:
=======
$v_val=$_POST['para'];
print &quot;$v_val[0][0]&quot;;
=======

I cannot make it work, on php2 file, it shows: &quot;Array[0]&quot; instead of showing &quot;123&quot;.

can anyone help me is it possible to pass 2-dimension parameter in form? Thanks in advance.
 
What version of PHP are you running?

Using the following form:

Code:
<html><body><form method=&quot;post&quot; action=&quot;show_post.php&quot;>
<input type=&quot;text&quot; name=&quot;foo[0][0]&quot;>
<input type=&quot;submit&quot;>
</form></body></html>

and the following script:

Code:
<?php

print '<pre>';

$foo = $_POST['foo'];

print $foo[0][0];

?>

I get what I enter into the form field as my output.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
thanks,sleipnir214.

I found the problem is I use:
print &quot;$v_val[0][0]&quot;;
instead of
print $v_val[0][0];

Now it works, thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top