Search
Left Quote    By failing to prepare, you are preparing to fail.
- Benjamin Franklin    
Right Quote
 
[login] | [Register]
Forum Index » PHP and mySQL » Viewing Topic and Replies
Post Reply


        Viewing Topic: How to Request.QuerySt ring in PHP?
  This user is offline  tito
  Subject: "How to Request.QuerySt ring in PHP?" Posted: @ 3:25 pm on Jan 22 2007   
Member #: 262
Rank: User - (1)
Since: 01/22/07
Posts: 1

Hello,

I tried to create a short PHP script work as when the user click on the link, the content of the selected link will show on the page. BUT it doesn't work. Below is my code. Would anyone help me to make it work please (I don't know anything in PHP but just try to poke around):

<html>
<body>
<p><a href="inde x.php?id=1" ;>Link1</ a> | <a href="inde x.php?id=2" ;>Link 2</a>< /p>
<p>&n bsp;</p>< br /> <?
$id = $_GET['id'];
if (id == 1){
?>
This is Link 1
<? } ?>

<?
if (id == 2){
?>
This is Link 222222222222222 2
<? } ?>

</body> </html>
// -----------end< br />
Many thanks!
Tito.

    Viewed: 4,941 Times | Reply to This | To top
  This user is offline  misterhaan
  Subject: "re: How to Request.QuerySt ring in ..." Posted: @ 5:09 pm on Jan 22 2007    

Member #: 5
Rank: User - (213)
Since: 02/11/05
Posts: 148
From: chair

when accessing a variable, you need the $ in front of it. so for both of your if statements, change id to $id. without the $ php treats id as the string 'id', which is never going to equal 1 or 2.




please note that the above post is likely made up in its entirety.

    Viewed: 4,934 Times | Reply to This | To top
Viewing Page: 1 of 1


1 |

You must be logged in to post on the forums. Login or Register








"AllSyntax.com" Copyright © 2002-2018; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank