我在我的if
和else
聲明中遇到了一個問題,它從不運行else
聲明。爲什麼if語句不運行else語句?
輸入形式是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>
這裏是PHP代碼:
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; }
}
}
}
這裏將顯示一些輸出條件:
$A = 'positive';
$B = 'negative';
if ($loan_credibility == 5){
echo $B ;}
else{
echo $A;
}
if是什麼意思?猜測$ marital_stat既不結婚也不是單一的 - 同樣,這將有助於知道這是哪種語言。 –
請提供一個完整的例子:http://stackoverflow.com/help/mcve – FPK
hi @LorenzoBoccaccia,我已經添加了一些輸入代碼的if和語言,如果其他語言是在php語言。 –