473,466 Members | 1,314 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

i am trying to setup a link in my page that will change my page

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?

May 17 '06 #1
2 1737
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.
js*******@attglobal.net
==================
May 17 '06 #2
Jerry thanks alot. I have been programming PHP for a month now and I
still forget little things. Here is the final code which worked of
course.

<?php
error_reporting(E_ALL ^ E_NOTICE);
$test =$_REQUEST['test'];

printf("<a href=\"%s?test=%s\">%s</a><br>\n", $_SERVER['PHP_SELF'],"1",
"Click Here");

if (isset($test)){
echo "$test</br>\n";
}
?>

May 17 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: pbj | last post by:
my application was created in vb.net, vs 2003. the setup project was also created in vs 2003. one of my application reviewers reported this: The .Net link that is included in the setup is not the...
1
by: JJ | last post by:
Hi, I have gone the setup project route and added the setup project to my solution as in the guide. I have checked the dependancy's and they all seem to be there. Now do I just build the project...
12
by: Ron Weldy | last post by:
I have a test server runinng 2003/IIS 6 with a mixture of asp and asp.net files. On my workstation I have a share set up to the folder where the web files reside. I am just doing quick and dirty...
25
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
1
by: Andrew | last post by:
I'm adding this as it to me a while to figure out all the pieces to be able to do this without using Microsoft.Office.Interop which caused me problems on the web-server. Streaming is the easy...
6
by: AppleBag | last post by:
I'm having the worst time trying to login to myspace through code. Can someone tell me how to do this? Please try it yourself before replying, only because I have asked this a couple of times in...
1
by: rsteph | last post by:
I've got some product information pages, with images and text, all setup within a table. I'm trying to add a small image in the upper right hand corner of the content div (where all the important...
12
by: dmorand | last post by:
I'm trying to get a 3 column layout with equal widths. Here is my page: domosworld.net I want it so the two gray borders in the middle always extend to the bottom of the page. I have it setup...
4
by: ARC | last post by:
I have reports that are designed to where it doesn't matter if the region using the program uses a letter sized paper or A4 sized. I have the width to be just slightly over 7", so the reports work...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.