NYCPHP Meetup

[nycphp-talk] lost in a maze of pages...

Ken Robinson kenrbnsn at rbnsn.com
Sun Mar 9 07:08:01 EST 2003


At 01:19 AM 3/9/2003 -0500, you wrote:

>Hi,
>i have a script (page1.php) where i select an id. this in turn calls the 
>following script. (page2.php)
><? include 'getdet.php'; (page3.php) require 'uploadfiles.php'; 
>(page4.php) ?>
>now in my getdet.php i have $rn = $_POST['RN']; and using this record 
>number i query the mysql database for the person's credentials. my display 
>is such that the getdet.php displays the credentials in a table followed 
>by boxes to enter the files's location (something like the yahoo 
>briefcase, i have scripted to upload 5 files at on time). now the problem 
>is i need the RN value in a script called 'verifyfiles.php' (page5.php) 
>which is called by the uploadfiles.php. i am able to get it using 
>something like
>     ...
>     <br><?$mrn = $_POST['MRN'];?>
>  <input type="hidden" name="mrn" value="<?=$mrn;?>">
>  <input type="submit" name="action" value="Upload Files" tabindex="11">
>     </form>
>in uploadfiles.php
>
>wot i want to know is if theres a better method to do this? the RN is set 
>in the page1.php, passed to page3.php called in page2.php, and is also 
>needed by page5.php (finally). now since page5.php is called by page4.php, 
>at present i am including the RN in the page4.php as a hidden field. is 
>there some way for the page5.php to get the value as page3.php does?
>
>the second, that i am unable to do is, say the user wishes to upload more 
>that 5 files, so he clicks on the upload more? link... i have <a 
>href="view.php"> upload more? </a> in page5.php. when i tried, i got error 
>"query failed". thats cos, view.php (page2.php) calls page3.php n thus 
>needs a RN. do i change the scripts to use $_REQUEST instead of $_POST i 
>am using now? in that case it would mean ?$RN appended. but any other 
>beter options plz?

The easiest way to do this is to uses SESSIONS. Put a "sesssion_start()" at 
the start of your PHP code in each file. In the file where it is defined 
put "$_SESSION['xx'] = rn;". In the files that need the value, put " rn = 
$_SESSION['xx']".

Read all about sessions in your favorite PHP reference guide or at www.php.net.

Ken Robinson




More information about the talk mailing list