Left Quote    You have to THINK anyway, so why not think BIG?
- Donald Trump    
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


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):

<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!

    Viewed: 6,617 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: Contributor - (214)
Since: 02/11/05
Posts: 149
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: 6,610 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

"" Copyright © 2002-2021; All rights lefted, all lefts righted.
Privacy Policy