Variable transfer through forms

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

User avatar
lacroix13
New php-forum User
New php-forum User
Posts: 64
Joined: Thu Aug 22, 2002 1:07 am

Variable transfer through forms

Postby lacroix13 » Wed Sep 11, 2002 4:36 am

In order to transfer some values in a form through the method post, i use a matrix of hidden fields
The code:
<input type="hidden" name="answer[$i][$j]" value="blah blah">

In the script that deals with this data, the variable $answer[$i][$j],$i and j are values that run in some intervals,prints "Array[something]" and not "blah blah".

What can i do? 8O

Jay

Postby Jay » Wed Sep 11, 2002 11:59 am

Give me an example or somewhere I can see what you're doing!

User avatar
lacroix13
New php-forum User
New php-forum User
Posts: 64
Joined: Thu Aug 22, 2002 1:07 am

Postby lacroix13 » Thu Sep 12, 2002 1:52 am

I've solved the problem in a different way.But here is the example of code.I'm intrigged why isn't it working:

$j=0;
while($j<15)
{
for($k=0;$k<$nom;$k++)
{
print("<input type='hidden' name='id_q[$j]' value=$linefin[1]>");
print(" <input type=\"checkbox\" name=\"checkbox[$j][$k]\">
<input type='hidden' name='id_a[$j][$k]' value=$lineans[1]>
<input type='hidden' name='corect[$j][$k]' value=$lineans[2> <br>");
print("<input type='hidden' name='quest_no[$j]' value=blah blah>");
$j++;
}
}

In the script that uses the data, print("$id_a[$j][$k]") gives Array[]

Jay

Postby Jay » Thu Sep 12, 2002 3:44 am

Instead of passing all these hidden values in this manner, why don't you just store the whole array in a session or cookie? It would be much simpler!


Return to “PHP coding => General”

Who is online

Users browsing this forum: Exabot [Bot] and 1 guest

cron