鍍金池/ 問答/PHP/ 這個不太懂怎么弄?

這個不太懂怎么弄?

clipboard.png
我想把這個數(shù)據(jù)輸出到這個文本框里?這個phpstorm確實(shí)挺好用

clipboard.png

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form action="p_switchmonth.php" method="post">
    輸入年份: <input type="text" name="yer"/>
    輸入月份: <input type="text" name="mth"/>
    <input type="submit" value="提交" name=""/>
    <!--這個月有 <input type="text" value="">-->
</form>
<?php
@$yer=$_POST['yer'] or die();
@$mth=$_POST['mth'] or die();
$yer=2017;
$mth=4;
if($mth ==1 || $mth == 3|| $mth == 5|| $mth == 7|| $mth == 8|| $mth == 10|| $mth == 12){
    echo "這個月是31天";
}
else if($mth == 4|| $mth == 6|| $mth == 9|| $mth == 11){
    echo "這個月是30天";
}
else if($mth == 2){
    if(isrunnian($yer)){
        echo "今年是閏年,這個二月是29天";
    }
    else{
        echo "這個月是29天";
    }
}
function isrunnian($yer){
    if($yer%4 ==0 && !$yer%100 ==0 || $yer%400 ==0){
        return true;
    }
    else{
        return false;
    }
}
?>
</body>
</html>
回答
編輯回答
我以為
<!DOCTYPE html>
<html lang="en">
<head>

    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<form action="index.php" method="post">

    輸入年份: <input type="text" name="yer"/>
    輸入月份: <input type="text" name="mth"/>
    <input type="submit" value="提交" name=""/>

</form>

<?php
@$yer=$_POST['yer'] or die();
@$mth=$_POST['mth'] or die();
$yer=2017;
$mth=4;
if($mth ==1 || $mth == 3|| $mth == 5|| $mth == 7|| $mth == 8|| $mth == 10|| $mth == 12){

    echo '這個月有 <input type="text" value="31天">';
}
else if($mth == 4|| $mth == 6|| $mth == 9|| $mth == 11){

    echo '這個月有 <input type="text" value="30天">';

}
else if($mth == 2){

    if(isrunnian($yer)){
        echo "今年是閏年,這個二月是29天";
    }
    else{
        echo "這個月是29天";
    }
}
function isrunnian($yer){

    if($yer%4 ==0 && !$yer%100 ==0 || $yer%400 ==0){
        return true;
    }
    else{
        return false;
    }
}
?>



</body>
</html>
2018年1月4日 03:27