我已经编写了注册页面的代码,每件事都很好,但我提交的数据没有存储在数据库中? [英] I had written code for register page every thing is fine but my submitted data not storing in data base?
本文介绍了我已经编写了注册页面的代码,每件事都很好,但我提交的数据没有存储在数据库中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document
<font color="white" face="Showcard Gothic">
<div id="formpag23">
<table width="510" border="1" align="center"><tbody><tr> <td colspan="2" align="center">Sign up</td> </tr> <tr> <td>Name:</td> <td></td> </tr> <tr> <td>Email-id:</td> <td></td> </tr> <tr> <td>Address:</td> <td></td> </tr> <tr> <td>Contact Number:</td> <td></td> </tr><tr> <td>Password</td> <td></td> </tr> <tr> <td>Re-enter Password</td> <td></td> </tr><tr><td colspan="2" align="center"></td>
input[type="submit"]{
/* change these properties to whatever you want */
background-color: #555;
color: #fff;
border-radius: 10px;
}
</tr> </tbody></table>
</div>
<?php
include("connect1.php");
$id=1;
$res2=mysqli_query($con,"select customer_id from sign_up");
while($row1=mysqli_fetch_array($res2))
{
$id++;
}
mysqli_query($con,"INSERT INTO `ourpjct1`.`sign_up`(`customer_id`)VALUES('$id')");
if(isset($_POST['button1']))
{
//mysqli_query($this->$con, $query) or die(mysqli_error($this->$con));
//echo "hi sign button is working";
//echo "hii";
//$_POST['number']="";
//$id=$_POST['id'];
$name=$_POST['name'];
$password=$_POST['password'];
$password1=$_POST['password1'];
$number=$_POST['number'];
$address=$_POST['address'];
//$number=$_POST['number'];
$email=$_POST['email'];
if($password==$password1)
{
echo "hi sign button is working";
mysqli_query($con,"INSERT INTO `ourpjct1`.`sign_up`('customer_name',`customer_id`,'customer_number',`customer_address`,`customer_password`,`customer_email`)VALUES('$name','$id','$address','$number','$password','$email')");
mysqli_query($con,"UPDATE `sign_up` SET `customer_name`='$name',`customer_address`='$address',`customer_number`='$number',`customer_password`='$password',`customer_email`='$email' WHERE `customer_id`='$id'");
echo "";
echo "";
echo "";
echo "<table><tbody><tr><td> </td><td>";
// $_POST['number']="";
// document.getElementsByName(name)="disabled";
//
//echo "";
}
}
?>
input[type="submit"]{
change these properties to whatever you want */
background-color: #555;
color: #fff;
border-radius: 10px;
}
我的尝试:
What I have tried:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document
<font color="white" face="Showcard Gothic">
<div id="formpag23">
<table width="510" border="1" align="center"><tbody><tr> <td colspan="2" align="center">Sign up</td> </tr> <tr> <td>Name:</td> <td></td> </tr> <tr> <td>Email-id:</td> <td></td> </tr> <tr> <td>Address:</td> <td></td> </tr> <tr> <td>Contact Number:</td> <td></td> </tr><tr> <td>Password</td> <td></td> </tr> <tr> <td>Re-enter Password</td> <td></td> </tr><tr><td colspan="2" align="center"></td>
input[type="submit"]{
/* change these properties to whatever you want */
background-color: #555;
color: #fff;
border-radius: 10px;
}
</tr> </tbody></table>
</div>
<?php
include("connect1.php");
$id=1;
$res2=mysqli_query($con,"select customer_id from sign_up");
while($row1=mysqli_fetch_array($res2))
{
$id++;
}
mysqli_query($con,"INSERT INTO `ourpjct1`.`sign_up`(`customer_id`)VALUES('$id')");
if(isset($_POST['button1']))
{
//mysqli_query($this->$con, $query) or die(mysqli_error($this->$con));
//echo "hi sign button is working";
//echo "hii";
//$_POST['number']="";
//$id=$_POST['id'];
$name=$_POST['name'];
$password=$_POST['password'];
$password1=$_POST['password1'];
$number=$_POST['number'];
$address=$_POST['address'];
//$number=$_POST['number'];
$email=$_POST['email'];
if($password==$password1)
{
echo "hi sign button is working";
mysqli_query($con,"INSERT INTO `ourpjct1`.`sign_up`('customer_name',`customer_id`,'customer_number',`customer_address`,`customer_password`,`customer_email`)VALUES('$name','$id','$address','$number','$password','$email')");
mysqli_query($con,"UPDATE `sign_up` SET `customer_name`='$name',`customer_address`='$address',`customer_number`='$number',`customer_password`='$password',`customer_email`='$email' WHERE `customer_id`='$id'");
echo "";
echo "";
echo "";
echo "<table><tbody><tr><td> </td><td>";
// $_POST['number']="";
// document.getElementsByName(name)="disabled";
//
//echo "";
}
}
?>
input[type="submit"]{
change these properties to whatever you want */
background-color: #555;
color: #fff;
border-radius: 10px;
}
</td></tr></tbody></table></font></td></tr></tbody></table></font>
推荐答案
id = 1;
res2 = mysqli_query(
res2=mysqli_query(
con, 从sign_up中选择customer_id);
while(
con,"select customer_id from sign_up"); while(
这篇关于我已经编写了注册页面的代码,每件事都很好,但我提交的数据没有存储在数据库中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文