forumnz Posted July 7, 2007 Share Posted July 7, 2007 Ok I want one text to show if the address bar reads ....com/page1.php?id=1 and another text to read if id=2 I have this code I made but Im a noob and it doesnt work. Please help. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php if ($id == 1) echo "Test 1"; if ($id == 2) echo "Test 2"; ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/58862-solved-if-based-on-address-bar/ Share on other sites More sharing options...
king arthur Posted July 7, 2007 Share Posted July 7, 2007 Just add $id = $_GET["id"] at the start of your php. Link to comment https://forums.phpfreaks.com/topic/58862-solved-if-based-on-address-bar/#findComment-292092 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.