我的页面刷新了,没有向数据库输入数据 [英] my page refesh with out entering data to database

查看:74
本文介绍了我的页面刷新了,没有向数据库输入数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的设计
..................

my design
..................

<table width="426" height="176" border="1">
       <caption>
         CUSTOMER REGISTRATION
       </caption>
       <tr>
         <td width="110">Customer ID</td>
         <td width="300"><form id="form5" name="form5" method="post" action="">
             <label for="cust_id"></label>
             <input type="text" name="cust_id" id="cust_id" />
         </form></td>
       </tr>
       <tr>
         <td>Customer Name</td>
         <td><form id="form6" name="form6" method="post" action="">
             <label for="cust_name"></label>
             <input type="text" name="cust_name" id="cust_name" />
         </form></td>
       </tr>
       <tr>
         <td>User name</td>
         <td><form id="form12" name="form12" method="post" action="">
           <input type="text" name="u" id="u" />
         </form>         </td>
       </tr>
       <tr>
         <td>Password</td>
         <td><form id="form13" name="form13" method="post" action="">
           <input type="text" name="p" id="p" />
         </form>         </td>
       </tr>
       <tr>
         <td>Customer Department</td>
         <td><form id="form7" name="form7" method="post" action="">
             <label for="cust_dep"></label>
             <input type="text" name="cust_dep" id="cust_dep" />
         </form></td>
       </tr>
       <tr>
         <td>Customer type</td>
         <td><form id="form8" name="form8" method="post" action="">
             <input type="radio" name="radio" id="staff" value="staff" />
             <label for="staff">Staff</label>
             <input type="radio" name="radio" id="Trainee" value="Trainee" />
             <label for="Trainee">Trainee</label>
             <input type="radio" name="radio" id="others" value="others" />
             <label for="others">Others</label>
         </form></td>
       </tr>
       <tr>
         <td>Customer Adress</td>
         <td><form id="form10" name="form10" method="post" action="">
             <label for="cust_add"></label>
             <textarea name="cust_add" id="cust_add" cols="45" rows="5"></textarea>
         </form></td>
       </tr>
       <tr>
         <td>Customer E-mail</td>
         <td><form id="form11" name="form11" method="post" action="">
             <label for="cust_email"></label>
             <input type="text" name="cust_email" id="cust_email" />
         </form></td>
       </tr>
       <tr>
         <td>Customer Phone number</td>
         <td><form id="form9" name="form9" method="post" action="">
             <label for="cust_phone"></label>
             <input type="text" name="cust_phone" id="cust_phone" />
         </form></td>
       </tr>
     </table>




我的联系
..............................




my connection
..............................

<?php
$con = mysql_connect("localhost","root","");
mysql_select_db("project", $con);
$id =$_POST['cust_id'];
$name =$_POST['cust_name'];
$user =$_POST['u'];
$pass =$_POST['p'];
$dep =$_POST['cust_dep'];
$type =$_POST['radio'];
$add =$_POST['cust_add'];
$email =$_POST['cust_email'];
$phn =$_POST['cust_phone'];

if(@$_POST['submit'])
{
echo $s="insert into employee(cust_id,cust_name,username,password,cust_dep,customertype,address,email,phone) values('$id','$name','$user','$pass','$dep','$type','$add','$email','$phn')";
echo "Your Data Inserted";
mysql_query($s);
}
else
echo "error";
?>

推荐答案

con = mysql_connect(" " " ); mysql_select_db("
con = mysql_connect("localhost","root",""); mysql_select_db("project",


con);
con);


id =
id =


这篇关于我的页面刷新了,没有向数据库输入数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆