I have a problem with my if and else statement in PHP where it never runs the else statement.
The input form is in HTML:
<input type="radio" name="marital_stat" id="single" value="single" />Single <input type="radio" name="marital_stat" id="married" value="married" />Married <input name="age" type="text" size="5" maxlength="3" placeholder="30" required/> <input name="work" type="radio" id="employee" value="employee" />Employee <input name="work" type="radio" id="own" value="own" /> Own Business <input name="work" type="radio" id="jobless" value="jobless" />Jobless <input name="place" type="radio" id="urban" value="urban" />Urban <input name="place" type="radio" id="rural" value="rural" />Rural</td> Here is the PHP Code:
if ($marital_stat == 'married') { if ($age >= 18 || $age < 59) { if ($work == 'jobless') { if ($place == 'rural') { $loan_credibility == 5; } } } } else if ($marital_stat == 'single') { if ($age >= 18 || $age < 59) { if ($work == 'employee') { if ($place == 'rural') { $loan_credibility == 1; } } } } Here is a condition that will display some output:
$A = 'positive'; $B = 'negative'; if ($loan_credibility == 5 ){ echo $B ;} else{ echo $A; }
$loan_credibility == 1;and$loan_credibility == 5to use a single equal sign, not double? If so, the please update your example code ...@Mohamed Belal pointed this out in his answer. So two problems to sum this up 1) incorrectif-else if-elseand incorrect=vs==