PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old June 6th, 2004, 11:20 PM
metoome metoome is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 18 metoome User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 53 m 38 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old June 7th, 2004, 12:14 AM
metoome metoome is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 18 metoome User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 53 m 38 sec
Reputation Power: 0
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

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > passing arrary variable from one form


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway