i am just fixing some form validation, and i seem to have a very odd issue.
$newsletter = $_POST['newsletter']; // value 0 or 1 is passed from form, as "value"
// input type is radiobuttens
then i have a very simple
if ($newsletter != "0" || $newsletter != "1") {
$error_message .= 'Invalid newsletter?<br />';
}
it does not pass this? i did try:
if ($newsletter != 0 || $newsletter != 1) {
does not pass either, but thats comparing a string to an int as far as i know
&&
instead of||
in the query - an OR is matched if either side is true, and the number is always going to be a 0 (which matches != 1) or 1 (which matches != 0)x != A || x != B
is always true iffA != B
.