Jump to content

IF statements not working


refiking

Recommended Posts

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>
<?
}
?>

Link to comment
https://forums.phpfreaks.com/topic/65854-if-statements-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.