PHP

Moderators: None (Apply to moderate this forum)
Number of threads: 1848
Number of posts: 5016

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
passing variables between PHP scripts Posted by festus on 31 Jul 2002 at 8:55 AM
I would very much appreciate it if someone could help be out. I have been battling to get some seemingly simple php code to work and have had no joy. I have a script that creates a list of categories and each element of this list is a link to the next script but depending on which one you click on varies the value of a variable that is passed over to this second script. This variable is then key in getting the next page to display the right info. I am pretty sure the variable gets asigned a value as it comes up at the bottom of the window,
like so nextscript.php?catid=1 but it doesn't get across to the next script! Even if i put a simple print in at the top of the script to print $catid it prints nothing let alone work as it is supposed to in the rest of the code.

I'm sure there's a simple answer and i would be very greatfull if someone would give it to me!

festus

Report
Re: passing variables between PHP scripts Posted by PrzemekG_ on 1 Aug 2002 at 5:20 AM
----------- SCRIPT_1.PHP ------------
<?
echo '<a href="SCRIPT_2.PHP">No Category</a>';
echo '<a href="SCRIPT_2.PHP?catid=1">Category 1</a>';
echo '<a href="SCRIPT_2.PHP?catid=2">Category 2</a>';
echo '<a href="SCRIPT_2.PHP?catid=3">Category 3</a>';
?>

----------- SCRIPT_2.PHP ------------
<?
if (! isset($catid) ){
echo 'You didn't selecte any category';
}else{
echo 'You selected the category '.$catid;
};
?>
-------------------------------------






 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.