想运行一个代码可以在表格中填年份自动跳出当年的生肖,不知道怎么把表格和php关联,请说一下要怎么改
<html><head><metahttp-equiv="content-type"content="text/html;charset=gbk"/></head><bo...
<html>
<head>
<meta http-equiv="content-type"content="text/html;charset=gbk"/>
</head>
<body>
<h1>生肖</h1>
<form>
请输入年份:<input type="text"size=4 maxlength=4 name="year">
<input type="submit"/>
</form>
<?php
$nume=($year-999)%12;
switch ($nume){
case 1:
echo "鼠";break;
case 2;
echo "牛";break;
case 3:
echo "虎";break;
case 4:
echo "兔";break;
case 5:
echo "龙";break;
case 6:
echo "蛇";break;
case 7:
echo "马";break;
case 8:
echo "羊";break;
case 9:
echo "猴";break;
case 10:
echo "鸡";break;
case 11:
echo "狗";break;
case 0:
echo "猪";break;
}
?>
</body>
</html> 展开
<head>
<meta http-equiv="content-type"content="text/html;charset=gbk"/>
</head>
<body>
<h1>生肖</h1>
<form>
请输入年份:<input type="text"size=4 maxlength=4 name="year">
<input type="submit"/>
</form>
<?php
$nume=($year-999)%12;
switch ($nume){
case 1:
echo "鼠";break;
case 2;
echo "牛";break;
case 3:
echo "虎";break;
case 4:
echo "兔";break;
case 5:
echo "龙";break;
case 6:
echo "蛇";break;
case 7:
echo "马";break;
case 8:
echo "羊";break;
case 9:
echo "猴";break;
case 10:
echo "鸡";break;
case 11:
echo "狗";break;
case 0:
echo "猪";break;
}
?>
</body>
</html> 展开
展开全部
<html>
<head>
<meta http-equiv="content-type"content="text/html;charset=gbk"/>
</head>
<body>
<h1>生肖</h1>
<form method='get'>
请输入年份:<input type="text"size=4 maxlength=4 name="year">
<input type="submit" name='submit'>
</form>
</body>
</html>
<?php
if($_GET[submit]){
$nume=($_GET['year']-999)%12;
switch ($nume){
case 1:
echo "鼠";break;
case 2;
echo "牛";break;
case 3:
echo "虎";break;
case 4:
echo "兔";break;
case 5:
echo "龙";break;
case 6:
echo "蛇";break;
case 7:
echo "马";break;
case 8:
echo "羊";break;
case 9:
echo "猴";break;
case 10:
echo "鸡";break;
case 11:
echo "狗";break;
case 0:
echo "猪";break;
}
}
?>
展开全部
<html>
<head>
<meta http-equiv="content-type"content="text/html;charset=gbk"/>
</head>
<body>
<h1>生肖</h1>
<form action="<?php echo $_SERVER['PHP_SELF'];?>">
请输入年份:<input type="text"size=4 maxlength=4 name="year">
<input type="submit"/>
</form>
<?php
$year = (int)isset($_GET['year']) ? $_GET['year'] : 2015;
$nume=($year-999)%12;
switch ($nume){
case 1:
echo "鼠";break;
case 2;
echo "牛";break;
case 3:
echo "虎";break;
case 4:
echo "兔";break;
case 5:
echo "龙";break;
case 6:
echo "蛇";break;
case 7:
echo "马";break;
case 8:
echo "羊";break;
case 9:
echo "猴";break;
case 10:
echo "鸡";break;
case 11:
echo "狗";break;
case 0:
echo "猪";break;
}
?>
</body>
</html>
<head>
<meta http-equiv="content-type"content="text/html;charset=gbk"/>
</head>
<body>
<h1>生肖</h1>
<form action="<?php echo $_SERVER['PHP_SELF'];?>">
请输入年份:<input type="text"size=4 maxlength=4 name="year">
<input type="submit"/>
</form>
<?php
$year = (int)isset($_GET['year']) ? $_GET['year'] : 2015;
$nume=($year-999)%12;
switch ($nume){
case 1:
echo "鼠";break;
case 2;
echo "牛";break;
case 3:
echo "虎";break;
case 4:
echo "兔";break;
case 5:
echo "龙";break;
case 6:
echo "蛇";break;
case 7:
echo "马";break;
case 8:
echo "羊";break;
case 9:
echo "猴";break;
case 10:
echo "鸡";break;
case 11:
echo "狗";break;
case 0:
echo "猪";break;
}
?>
</body>
</html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询