-1
我是一個新的PHP。用這個試驗很多。我寫了另一個代碼。但它顯示了第26行的錯誤。我無法找到問題。請檢查並告訴我問題是什麼。 result.php不能找到第6行上的錯誤
<?php
if (isset ($_POST["name"])){
$name=$_POST["name"];
}
if(isset ($_POST["yob"])){
$yob=(int) $_POST["yob"];
}
if(isset ($_POST["wifename"])){
$wifename=$_POST["wifename"];
}
if(isset ($_POST["wyob"])){
$wyob= (int) $_POST["wyob"];
}
$currentyear=date("Y");
if($yob>=$currentyear){
echo "Sorry {$name} you have not born yet.";
}
if($currentyear>$yob){
$husbandage=$currentyear-$yob;
}
if($wyob>=$currentyear){
echo "Sorry {$name} your mother in law is still virgin.";
}
else{$wifeage=$currentyear-$wyob;}
if($husbandage>$wifeage){
echo "You are {"$husbandage-$wifeage"} years older than your wife";
}
if($husbandage<$wifeage){
echo "You are {$wifeage-$husbandage} years older than your wife";}
if($husbandage==$wifeage){
echo "You and your wife are same age";}
?>
agecalculator.php
<html>
<title>Age Difference Calculator</title>
<body>
<form action="result.php" type="post">
Your Name: <input type="text" name= "name"><br/>
Year Of Birth: <input type= "text" name:"yob"><br/>
Your Wife's Name: <input type="text" name="wifename"><br/>
Your Wife's Year Of Birth: <input type="text" name="wyob"><br/>
<input type="submit">
</form>
</body>
</html>
有什麼錯誤? – Dinesh 2013-04-28 23:50:00
什麼是'{int} $ _ POST [「yob」];'?嘗試'(int)$ _ POST [「yob」]' – mash 2013-04-28 23:50:18
好吧,我修好了。但現在問題出現在第24行。請告訴我我在第24行發生了什麼錯誤? – supto 2013-04-28 23:59:37