473,387 Members | 1,760 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 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 2629
"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 from it. This is how my TestPage.php looks...
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 that?
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 click on a link and will not be taken to another...
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 address has a Google page rank of three. The other...
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 for relative URL. e.g. If I apply following css...
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 to change to "Logout". I am using forms-based...
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 returns? Thanks, Homa Wong
1
by: Anonieko | last post by:
Query: How to display progress bar for long running page Answer: Yet another solution. REFERENCE: http://www.eggheadcafe.com/articles/20050108.asp My only regret is that when click the...
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 String) Try WebBrowser1.Navigate(New Uri(nomesito))
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...

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.