<form name="MsgForm" method="post" action="SubMsg.php" onsubmit="return CheckForm()"><label for='jqshul'>机器数量</label><input name="jqshul" type="text" class="InputBorder" id="jqshul" size="66"> <input type="submit" name="Submit" value="预定"></form>
后台 SubMsg.php
<? if (!isset($jqshul)){echo "机器数量不存在,"return} echo $jqshul//这个变量就是从前台接收的机器数量. 字段的name 是什么就写什么// 如何写入数据库, 要看用什么数据库了 要配置数据库不是一两句能说清的了//大致流程 是配置数据库打开数据连接>> 根据变量生成SQL语句>>执行语句?>
注册页面:reg.html<form action="reg.php" method="POST">
<table>
<tr><td>用户名:</td><td><input type="username" size="20"></td></tr>
<tr><td>密码:</td><td><input type="userpass" size="20"></td></tr>
<tr><td>确认密码:</td><td><input type="ruserpass" size="20"></td></tr>
<tr><td>邮箱:</td><td><input type="email" size="50"></td></tr>
<tr><td>电话:</td><td><input type="telphone" size="20"></td></tr>
<tr><td><input type="Submit" value="注册"></td></tr>
</table>
</form>
接收页面:reg.php
<%php
$db = mysql_connect("localhost", "root", "12345")
mysql_select_db("dataname", $db)
mysql_query("insert into tablename(username, userpass, email, telphone) values('$_POST[username]', '$_POST[userpass]', '$_POST[email]', '$_POST[telphone]')")
echo "注册成功"
%>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)