|
Posted by Jerry Stuckle on 05/17/06 05:18
rich wrote:
> I am working on a page with a right column that I want to use for
> navigation. In this right column I am using the below code to set a
> value for the link. I am using the variable $test right now.
> I want to click on the link and when the value is set to a certain
> value, say 1, I want the script to run and load a page based on a
> switch case. This way I can use different links for navigation that
> will load different forms and areas of my application. So here is the
> code for the link line.
>
> printf("<a href=\"%s?test=%s\">%s</a><br>\n", $_SERVER['PHP_SELF'],"1",
> "Click Here");
>
> I then want a switch statement to the effect
>
> switch($test) {
> case "1" :
> Load form1
> case "2" :
> Load form2
> case "3" :
> Load form3;
> }
>
> To test out my idea I wrote this little test script to see if I could
> get the response I wanted and it didn't work. I wanted to click on the
> link and then get the value of test to echo back at me on the page.
> Here is that code. I called the file testlink.php
>
> <?php
>
> printf("<a href=\"%s?test=%s\">%s</a><br>\n", $_SERVER['PHP_SELF'],"1",
> "Click Here");
>
> if (isset($test)){
> echo "$test</br>\n";
> }
> ?>
> I get the right info in my url in my browser,
>
> http://localhost/testlink.php?test=1
>
> But I don't get the echo on the screen. Can anyone help?
>
$test = isset($_GET['test']) ? $_GET['test'] : null;
Add before you first use $test.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|