Jump to content

if($_GET is equal to something


brem13

Recommended Posts

im trying to get an if statement working but it doesnt seem to want to see if the get statement is equal to something

$sent = $_GET['message'];
if($sent=="sent")

 

i also tried

if($_GET['message']=="sent")

neither work, any suggestions?

Link to comment
Share on other sites

thank you, i tried that and still the same thing

modified code to look like

if (isset($_GET['message']) && $_GET['message'] == 'sent') 
	mysql_query("DELETE FROM sent WHERE id = '$id' AND userto = '$userLoggedIn'");
else
	mysql_query("DELETE FROM messages WHERE id = '$id' AND userto = '$userLoggedIn'");

and the url is  messages.php?id=4&message=sent&delPerm=yes

Link to comment
Share on other sites

How do you know it's not working?

 

If you change the "if" statement to be:

<?php
if (isset($_GET['message']) && $_GET['message'] == 'sent') {
    echo "is sent<br>\n";
} else {
    echo "is NOT sent<br>\n";
}
?>

What is display?

 

Ken

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.