refiking Posted August 20, 2007 Share Posted August 20, 2007 No matter what I've tried, my if statement from loanapp6.php won't work. I'm trying to filter out people who have more than 2 homes. No matter what I select it ALWAYS performs the IF statement. I only want it to perform the if statement when the value from loanapp5.php is 3. Here are the two pages of code. loanapp5.php <?php session_start(); print $name; $value = $_POST['value']; $_SESSION['value'] = $value; print $_SESSION['value']; ?> <html> <head><title>1003 App</title></head> <body> <h2>Do you have multiple houses or one residence?</h2><p> <form action="loanapp6.php" method="post"> <select name="nhouses" size="1"> <option value="1">1</option> <option value="2">2</option> <option value="3">3 or More</option> </select> <input type="submit" value="Next"> </form> </body> <p> <a href="dnc.php"> Add To Do Not Call List</a> </p> <p> <a href="lacontinue.php"> Continue Another Time</a> </p> </html> loanapp6.php <?php session_start(); print $name; $nhouses = $_POST['nhouses']; IF ($nhouses = 3) { PRINT "I can't help you."; } ELSE { $_SESSION['nhouses'] = $nhouses; print $_SESSION['nhouses']; ?> <html> <head><title>1003 App</title></head> <body> <h2>Do you have two loans like a first mortgage and a home equity loan or do you just have one loan?</h2><p> <form action="loanapp7.php" method="post"> <select name="nmort" size="1"> <option value="1">1 Mortgage</option> <option value="2">2 Mortgages</option> <option value="3">More Than 2 Mortgages</option> </select> <input type="submit" value="Find Now"> </form> </body> <p> <a href="dnc.php"> Add To Do Not Call List</a> </p> <p> <a href="lacontinue.php"> Continue Another Time</a> </p> </html> <? } ?> Quote Link to comment https://forums.phpfreaks.com/topic/65854-if-statements-not-working/ Share on other sites More sharing options...
micah1701 Posted August 20, 2007 Share Posted August 20, 2007 change: IF ($nhouses = 3){ to: IF ($nhouses == 3){ or better yet: IF ($nhouses > 2){ Quote Link to comment https://forums.phpfreaks.com/topic/65854-if-statements-not-working/#findComment-329146 Share on other sites More sharing options...
refiking Posted August 20, 2007 Author Share Posted August 20, 2007 I used this one: IF ($nhouses > 2){ Quote Link to comment https://forums.phpfreaks.com/topic/65854-if-statements-not-working/#findComment-329151 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.