当前位置:首页> PHP教程> PHP代码
关键字
文章内容
一个用PHP和MYSQL写的定饭系统
 
 
修改时间:[2008/08/07 22:33]    阅读次数:[1466]    发表者:[起缘]
 
前台html
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>定饭</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<meta name="Microsoft Theme" content="arcs 011">
</head>

<body background="arctile.jpg" bgcolor="#FFFFFF" text="#000000" link="#3399FF"
vlink="#3366CC" alink="#FF9900">

<form enctype="multipart/form-data" action="eat.php" method="post" align="center">
<p> </p>
<p><font color="#0000FF"><strong><big><big><big><big>吃饭了!哈哈哈!</big></big></big></big></strong></font></p>
<!--mstheme--> </font><table border="1" width="100%" bordercolorlight="#FFCC66" bordercolordark="#CC9966">
<tr>
<td width="33%">点菜的同志: <select name="name" size="1">
<option value="老李">老李</option>
<option value="老张">老张</option>
<option value="小汪">小汪</option>
<option value="小马">小马</option>
</select><!--mstheme--></font></td>
<td width="33%">菜名选择: <select name="eat" size="1">
<option value="鱼香肉丝">鱼香肉丝</option>
<option value="回锅肉">回锅肉</option>
<option value="莲菜炒肉">莲菜炒肉</option>
<option value="蒜薹炒肉">蒜薹炒肉</option>
<option value="泡菜炒肉">泡菜炒肉</option>
<option value="青笋炒肉">青笋炒肉</option>
<option value="糖醋里脊">糖醋里脊</option>
<option value="西芹炒肉">回锅肉</option>
<option value="红烧带鱼">回锅肉</option>
<option value="火爆腰花">回锅肉</option>
<option value="辣子鸡">辣子鸡</option>
<option value="时椒炒牛肉">回锅肉</option>
<option value="红烧排骨">回锅肉</option>
<option value="糖醋里脊">糖醋里脊</option>
<option value="木耳肉片">木耳肉片</option>
<option value="干煸波菜">干煸波菜</option>
<option value="西芹炒蜡肉">西芹炒蜡肉</option>
<option value="细沙炒八宝">细沙炒八宝</option>
<option value="干煸豆角">干煸豆角</option>
<option value="五彩炒虾仁">五彩炒虾仁</option>
<option value="醋溜西葫芦">醋溜西葫芦</option>
<option value="大蒜肚条">大蒜肚条</option>
<option value="鱼香茄子">鱼香茄子</option>
<option value="重庆辣子鸡">重庆辣子鸡</option>
<option value="红烧鸡翅">红烧鸡翅</option>
<option value="家常豆腐">家常豆腐</option>
<option value="西红柿炒鸡蛋">西红柿炒鸡蛋</option>
<option value="宫爆鸡丁">宫爆鸡丁</option>
<option value="时椒炒牛肉">时椒炒牛肉</option>
</select><!--mstheme--></font></td>
<td width="34%">主食: <select name="zs" size="1">
<option value="米饭">米饭</option>
<option value="馒头">馒头</option>
</select><!--mstheme--></font></td>
</tr>
</table>
<p><br>
<input type="submit" value=" 提交给李凯"> </p>
</form>
<!--mstheme--></font>
</body>
</html>
//后台php eat.php
<?php
$conn = odbc_connect("blue", "root", "");
$datetime=date("h:i A l")."_".date("F dS, Y");
$query ="insert into eat ( name,eat,zs,uptime) values ('$name','$eat','$zs','$datetime')";
odbc_do($conn, $query);
echo "成功发送!";
$query = "select * ";
$query .= "from eat";
odbc_result_all( odbc_do($conn, $query), "border=1");
odbc_close($conn);
?>

//mysql表结构
CREATE TABLE eat(
name char(40),
eat char(40) ,
zs char(40) ,
datetime char(40)
);