Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

passing variables between PHP scripts

festusfestus Member Posts: 2
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

Comments

  • PrzemekG_PrzemekG_ Member Posts: 595
    ----------- SCRIPT_1.PHP ------------
    <?
    echo '<a href="SCRIPT_2.PHP">No Category';
    echo 'Category 1';
    echo 'Category 2';
    echo 'Category 3';
    ?>

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



  • Justin BibJustin Bib USAMember Posts: 0

    __ \ http://forcoder.org \ free ebooks and video tutorials about { Ruby MATLAB Objective-C Swift Python C++ JavaScript Java Go Perl PL/SQL Visual Basic Assembly Delphi R C# Visual Basic .NET C PHP Scratch Ada Erlang ABAP FoxPro Scala F# VBScript Transact-SQL Lisp Apex Prolog Rust Julia Clojure SAS Fortran Dart Awk Hack LabVIEW D Scheme Crystal Lua Alice Kotlin COBOL Logo ML Bash } _______

Sign In or Register to comment.