Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

URL Parameters 2

Status
Not open for further replies.

jsteiner87

Programmer
Oct 9, 2003
76
US
I am trying to set up an area on my page that will only display information if a URL Parameter is present.
What I have is a value that is pass thru the URL called nameplate_id and if there is a value I want to have part of my page displayed. I don't want to display part of the page if nameplate_id does not show up in the URL. How do I setup that If statement?
 
The parameter passed would be in the superglobal array $_GET.
Your if statement would check if there is a value in the GET array under they key 'nameplate_id'.
Code:
if (isset($_GET['nameplate_id']) AND !empty($_GET['nameplate_id']){
   /* whatever happens here... )*/
}
The second part of the condition here checks if there is a value in the GET parameter. Be aware that the value '0' (zero) would also return true.
 
Code:
html stuff...

When you get to the part of the page you want to display if there's a value for nameplate_id:
<?php
if ($_GET['nameplate_id']){
  display part of that page.
}
?>

rest of the html stuff...

[cheers]
Cheers!
Laura
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top