Jump to content

checking to see if a $_GET variable is something or another


dazzclub

Recommended Posts

Hi guys i would like to check if a variable has been set and to find out wether its a particular number and which then takes it to the write page.

 

i have two numbers i would like to check for, 67 and 68.

 

If its 68 go here else go 67.

 

here is my function so far;

function subLevels()
{
if ((isset($_GET['cat_id']) ) && (isset($_GET['sublvl_id'])) && (is_numeric($_GET['cat_id'])) && (is_numeric($_GET['sublvl_id'])) ) { //correctly accessed 
$cat_id=$_GET['cat_id'];
$sublvl_id=$_GET['sublvl_id'];

} else { 
$errors[] = 'You have accessed this page incorrectly.'; 
}
global $dbc;
$query ="SELECT * FROM SubCat1 WHERE CategoryID = $cat_id AND SubLevelID = $sublvl_id
	ORDER BY SubCatID";		
$result = mysqli_query ($dbc, $query)or die(mysqli_error() . "<p>With query:<br>$query");
while ($row = mysqli_fetch_assoc($result))
{
//need to format the date on this function
//get NewsID
echo "<li><a href=\"industrial.php?medical_product=$row[CategoryID]&sublvl_id=$row[subLevelID]&subcat_id=$row[subCatID]\">$row[subCatName]</a></li>";	
}
}

 

Any help would be grea! :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.