这个不太懂怎么弄?

clipboard.png
我想把这个数据输出到这个文本框里?这个phpstorm确实挺好用

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>
阅读 1.8k
1 个回答
<!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>
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题