|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
passing arrary variable from one form
hello freinds..
i need your help in passing php array variable variable . i am trying to develop a game application, in which the user is given a randomly picked up question from the database. but it acutally does not do it , the question no to be picked up is stored in an array. the navigation goes like this login.php->check.php->initial.php->time.php->found.php->time.php->found.php-> till the qno in the last index of the array is selected. first i pick the first question no in the initial.php mamually by setting the variable $qno=arrayname[0];( the arrayname is $qnarray) and this is passed to the time.php and inturn to found.php but when i come back to time.php to fetch the 2nd question no form the array i am not able to fetch it.. and here is the peice of code ..that will give u better understanding. Code:
initial.php
<?
.
.
$actualqno=$qnarray[0];
?>
<form name="ready" action="time.php" method="post">
.
.
<td><input type="hidden" name="qnarray" value="<?=$qnarray?>"></td>
<td><input type="hidden" name="actualqno" value="<?=$actualqno?>"></td>
</form>
</div>
.
.
**********
time.php
<?
.
.
$qnarray=$_POST['qnarray'];
$actualqno=$_POST['actualqno'];
echo"the qnarray is $qnarray"."<br>";
for($i=1;$i<10;$i++)
echo" the value of array is $qnarray[Array][$i]"."<br>";
print_r($qnarray);
.
.
.
?>
the display i get is in the browser corresponding to tim.php is
the qnarray is Array
the value of array is A[1]
the value of array is A[2]
the value of array is A[3]
the value of array is A[4]
the value of array is A[5]
the value of array is A[6]
the value of array is A[7]
the value of array is A[8]
the value of array is A[9]
Array
*********
but when i modify the code in time.php as
<?
$qnarray=$_POST['qnarray'];
$actualqno=$_POST['actualqno'];
echo"the qnarray is $qnarray"."<br>";
//for($i=1;$i<10;$i++)
//echo" the value of array is $qnarray[Array][$i]"."<br>";
//print_r($qnarray);
.
.
$actualqno=nextno($qnarray);
.
.
?>
get the display as the qnarray is Array Fatal error: Call to undefined function: nextno() in /home/sites/doondo/game1.2/time.php on line 16 so please do help me i am not clear with the concepts... thanks in advance.... Last edited by stumpy : June 7th, 2004 at 12:30 AM. Reason: Please place code in [code] tags, as per the forums rules |
|
#2
|
|||
|
|||
|
sorry friends some corrections the code
Code:
<?
$qnarray=$_POST['qnarray'];
$actualqno=$_POST['actualqno'];
echo"the qnarray is $qnarray"."<br>";
//for($i=1;$i<10;$i++)
//echo" the value of array is $qnarray[Array][$i]"."<br>";
//print_r($qnarray);
.
.
$actualqno=next($qnarray); (change is made here..)
.
.
?>
get the display as the qnarray is Array Warning: Variable passed to next() is not an array or object in /home/sites/doondo/game1.2/time.php on line 16 Fatal error: Call to undefined function: fetchinto() in /home/sites/doondo/game1.2/time.php on line 47 so please do help me i am not clear with the concepts... thanks in advance.... Last edited by stumpy : June 7th, 2004 at 12:30 AM. Reason: Please place code in [code] tags, as per the forums rules |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > passing arrary variable from one form |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|