# Simple if statement not working

**URL:** <https://forum.kirupa.com/t/simple-if-statement-not-working/69673>\
**Category:** programming\
**Created:** [November 6, 2004, 7:43pm UTC](https://forum.kirupa.com/t/simple-if-statement-not-working/69673 "2004-11-06T19:43:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![3Darklight](https://avatars.discourse-cdn.com/v4/letter/3/db5fbb/32.png) [@3Darklight](https://forum.kirupa.com/u/3Darklight)\
**Post date:** [November 6, 2004, 7:43pm UTC](https://forum.kirupa.com/t/simple-if-statement-not-working/69673/1 "2004-11-06T19:43:21Z")

</div>

$variable = $\_POST[‘variable’];  
if ($variable == “certaintext”) {  
do something;  
} else {  
do something else;  
}

everything else outside this script is working fine, but here it’s ignoring the if statement and doing both of what is inside the if and the else statements. the $variable works fine if i echo it, so i don’t know what’s wrong with this.

thanks in advance for any help.
