472,326 Members | 1,688 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,326 software developers and data experts.

php page will not process link to diff page

Hello PHPers,
I have just installed RH Linux ES 3.0 (basic) kernel 2.4.21-9.EL, i686,
Apache 2.0.X, and php 4.2.X. I have made no changes to the php.ini.

I am trying to use the following page (code listed here) to click on
link, and display 1 of three pages. The code does not seem to work, it
only shows the "else" condition of the php code, which is page:
"stuff.php". What do I need to do to my apache/php config to get this
to work??? Of course I copied this code from a php site tutorial somewhere.

Thanks,

eric

Page code below:
<?
if ($link == page2){
$page="files/page2.html";
}
elseif($link == page3){
$page="files/page3.html";
}
else{
$page="files/stuff.php";
}
?>
<html>
<head>
<title> index.php </title>
</head>
<body bgcolor="#999999">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td colspan="3"><h1>The Template (index.html)</h1></td>
</tr>
<tr>
<td align="center" valign="top"><a href="index.php?link=index">
Page 1 </a></td>
<td align="center" valign="top"><a href="index.php?link=page2">
Page 2 </a></td>
<td align="center" valign="top"><a href="index.php?link=page3">
Page 3 </a></td>
</tr>
</table>
<? include($page); ?>
</body>
</html>

Jul 17 '05 #1
3 2554
"Eric W. Holzapfel" <e.****@verizon.net> wrote in
news:oN*****************@nwrddc02.gnilink.net:
I am trying to use the following page (code listed here) to click on
link, and display 1 of three pages. The code does not seem to work,
it only shows the "else" condition of the php code, which is page:
"stuff.php". What do I need to do to my apache/php config to get this
to work??? Of course I copied this code from a php site tutorial
somewhere. Page code below:
<?
if ($link == page2){
$page="files/page2.html";
}
elseif($link == page3){
$page="files/page3.html";
}
else{
$page="files/stuff.php";
}
?>
<html>


Where does $link get its value? Unless there's some other code you didn't
show that sets it, it's going to be NULL and therefore neither of the first
two comparison will succeed. Also, page2 and page3 really need to be
quoted in the comparisons.
Jul 17 '05 #2
Eric Bohlman wrote:
"Eric W. Holzapfel" <e.****@verizon.net> wrote in
news:oN*****************@nwrddc02.gnilink.net:

I am trying to use the following page (code listed here) to click on
link, and display 1 of three pages. The code does not seem to work,
it only shows the "else" condition of the php code, which is page:
"stuff.php". What do I need to do to my apache/php config to get this
to work??? Of course I copied this code from a php site tutorial
somewhere.


Page code below:
<?
if ($link == page2){
$page="files/page2.html";
}
elseif($link == page3){
$page="files/page3.html";
}
else{
$page="files/stuff.php";
}
?>
<html>

Where does $link get its value? Unless there's some other code you didn't
show that sets it, it's going to be NULL and therefore neither of the first
two comparison will succeed. Also, page2 and page3 really need to be
quoted in the comparisons.

Hello and Thanks, I "thought" that $link gets set by clicking on the
link on the index.php i.e. <href="index.php?link=page2"> Page 2 </a></td>
here I thought the $link gets the value "page2"??? Obviously I am
missing somthing (total beginner here!)
It is not clear to me how $link can get set.

Thanks for your help,
eric

Jul 17 '05 #3
Eric W. Holzapfel wrote:
Eric Bohlman wrote:
"Eric W. Holzapfel" <e.****@verizon.net> wrote in
news:oN*****************@nwrddc02.gnilink.net:
I am trying to use the following page (code listed here) to click on
link, and display 1 of three pages. The code does not seem to work,
it only shows the "else" condition of the php code, which is page:
"stuff.php". What do I need to do to my apache/php config to get this
to work??? Of course I copied this code from a php site tutorial
somewhere.

Page code below:
<?
if ($link == page2){
$page="files/page2.html";
}
elseif($link == page3){
$page="files/page3.html";
}
else{
$page="files/stuff.php";
}
?>
<html>


Where does $link get its value? Unless there's some other code you
didn't show that sets it, it's going to be NULL and therefore neither
of the first two comparison will succeed. Also, page2 and page3
really need to be quoted in the comparisons.


Hello and Thanks, I "thought" that $link gets set by clicking on the
link on the index.php i.e. <href="index.php?link=page2"> Page 2 </a></td>
here I thought the $link gets the value "page2"??? Obviously I am
missing somthing (total beginner here!)
It is not clear to me how $link can get set.

Thanks for your help,
eric

You should add this line to the top of the page (after the <?php) if you
want $link to contain the variable 'link' from the querystring:

$link = $_GET['link'];

You should also add single quotes ( ' ) around page2 and page3 in your
if statement.

Chris
Jul 17 '05 #4

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

Similar topics

21
by: deko | last post by:
Is it possible to call a php script from an html page? I have a TestPage.php that I want to convert to TestPage.html - but still call a php script...
1
by: Cyril Vi?ville | last post by:
I wanna make a prog that launch with fork 2 diff process under 2 diff users and kill the parent process. Is that possible? and if yes how can i do...
4
by: A.S. | last post by:
I would like to have a link that when clicked, sends info to an ASP page to process, but does not submit the entire page. This way, the user will...
32
by: sandy | last post by:
I have a hobby website at: http://www.montana-riverboats.com which also resolves as: http://montana-riverboats.com ...without the www. One...
7
by: Nilesh | last post by:
I am using background-image attribute in a CSS file and linking the CSS file to aspx page. But strangly, background-image attribute is not working...
8
by: Judy Ward | last post by:
I have an index.aspx with frames. The top frame has a navigation bar with a "Login" hyperlink. If the user has already logged in I want this link...
5
by: Homa | last post by:
Hi all, Can anyone give me some links about how to do an async web service call from aspx and display a temperary page before the web service...
1
by: Anonieko | last post by:
Query: How to display progress bar for long running page Answer: Yet another solution. REFERENCE:...
1
by: ilario santamaria | last post by:
hello loading a page in webbroser, try a link and click, you open the pagita everything ok Private Sub caricapagina(ByVal nomesito As...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

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.