Jump to content

type_unknow


etsted

Recommended Posts

i have here a tekst field and a button, that interacts with php using ajax

 

$status_ui = '<textarea id="statustext" onkeyup="statusMax(this,250)" placeholder="What's new with you '.$u.'?"></textarea>'; $status_ui .= '<button id="statusBtn" onclick="postToStatus('status_post','a',''.$u.'','statustext')">Post</button>';

 

But i get some sort of an error, which i dont know why is there

 

i get all the variables using the postToStatus function, and then send them to a php script using:

 

ajax.send("action="+action+"&type="+type+"&user="+user+"&data="+data);

 

in the php script i have an if statement

 

if($_POST['type'] != 'a' || $_POST['type'] != 'c')

{

echo "type_unknow";

exit;

}

 

it doesnt say anything about $_POST['type'], but when i run print_r i can see that the $_POST['type'] is set

Edited by etsted
Link to comment
Share on other sites

Your logic is wrong. The variable is always either not "a" or not "c".

 

If it's "a" then it's not "c", if it's "c" then it's not "a", if it's neither "c" nor "a" then that statement is true as well. Use && instead of ||

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...