发布时间:2022-11-23 21:10:58 点击数:688
考试要求
<html>
<?php
if ($_POST) {
$nian = date('Y');
$yue = $_POST['yue'];
if ($yue < 1 || $yue > 12 || !is_numeric($yue)) {
echo '您输入的月份有误!';
} else {
$tian = '';
$time = $nian . '-' . $yue;
$mtime = strtotime($time);
$res = date("t", $mtime);
}
}
?>
<body>
<div style="width: 360px;float:left">
<form method="post" action="">
月份:<input type="text" name="yue" value="<?php echo $yue; ?>"><input type="submit" value="查看"><br />
<?php
if ($res) {
echo $time . "有{$res}天";
} else {
echo "请输入您要查询的月份!<br />";
}
?>
<?php
echo date('Y年m月d日 H点i分s秒'); ?>
</form>
</div>
<div style="width: 360px;float:left">
<h3>姓名:222</h3>
<h3>学号:2</h3>
</div>
</body>
</html>
<?php
session_start();
define('DB_HOST', '127.0.0.1');
define('DB_USER', 'root');
define('DB_PWD', 'root');
define('DB_NAME', 'ku');
$conn = @mysqli_connect(DB_HOST, DB_USER, DB_PWD, DB_NAME) or die('数据连接失败'); //连接数据库
mysqli_query($conn, 'SET NAMES UTF8') or die('字符集错误');
if ($_POST) {
$query = mysqli_query($conn, "insert into chanpin (name,leixing,shuliang) values ('{$_POST['name']}','{$_POST['leixing']}','{$_POST['shuliang']}')");
echo "<script type='text/javascript'>alert('入库成功');window.location.href='1.php';</script>";
}
?>
<form method="post">
产品进货<br /><br /><br />
<input type="text" name="name" placeholder="产品名称" /><br /><br />
<input type="number" name="shuliang" placeholder="产品数量" /><br /><br />
<select name="leixing">
<?php
$_query = mysqli_query($conn, "select * from fenlei");
while ($_rows = mysqli_fetch_array($_query, MYSQLI_ASSOC)) {
echo "<option value='{$_rows['leixing']}'>{$_rows['leixing']}</option>";
}
?>
</select><br /><br />
<input type="submit" value="入库"></input>
<input type="reset" value="重置"></input>
</form>