PHP注册页面,没有错误,也没有提交到数据库?

时间:2016-01-13 15:19:49

标签: php mysql sql

我已经看过类似的帖子,但我似乎无法匹配已发生的决议或问题,因为我的代码似乎有所不同。



<?php     //start php tag
//include connect.php page for database connection
Include('connection.php');
//if submit is not blanked i.e. it is clicked.
If(isset($_REQUEST['submit'])!='')
If(
  $_REQUEST['firstname']=='' ||
  $_REQUEST['lastname']=='' ||
  $_REQUEST['username']==''||
  $_REQUEST['password']=='' ||
  $_REQUEST['email']=='' || 
  $_REQUEST['phonenumber']=='' || 
  $_REQUEST['address']=='' || 
  $_REQUEST['town']=='' || 
  $_REQUEST['country']=='' || 
  $_REQUEST['postcode']==''
)
{
Echo "please fill the empty field.";
}
Else
{
$sql="
  insert into customers
    (firstname,lastname,username,password,email,phonenumber,address,town,country,postcode)
    values(
      '".$_REQUEST['firstname']."', 
      '".$_REQUEST['lastname']."', 
      '".$_REQUEST['username']."', 
      '".$_REQUEST['password']."', 
      '".$_REQUEST['email']."', 
      '".$_REQUEST['phonenumber']."', 
      '".$_REQUEST['address']."', 
      '".$_REQUEST['town']."', 
      '".$_REQUEST['country']."', 
      '".$_REQUEST['postcode']."'
    )";
$res=mysql_query($sql);
$sql="insert into payments(method,expiry) values('".$_REQUEST['method']."', '".$_REQUEST['expiry']."')";
$res=mysql_query($sql);
If($res)
{
Echo "Record successfully inserted";
}
Else
{
Echo "There is some problem in inserting record";
}

}


?>
&#13;
<div class="modal-body">
  <p>Enter your details below</p>
  <form role="form" action="insert.php" method="post">
    <div class="form-group">
      <label class="control-label" name="firstname">First Name</label>
      <input class="form-control" type="text" placeholder="Enter First Name">
    </div>
    <div class="form-group">
      <label class="control-label" name="lastname">Last Name</label>
      <input class="form-control" type="text" placeholder="Enter Last Name">
    </div>
    <div class="form-group">
      <label class="control-label" name="username">Username</label>
      <input class="form-control" placeholder="Username" type="text">
    </div>
    <div class="form-group">
      <label class="control-label" for="exampleInputPassword1" name="password">Password</label>
      <input class="form-control" id="exampleInputPassword1" placeholder="Password" type="password">
    </div>
    <div class="form-group">
      <label class="control-label" for="exampleInputEmail1" name="email">Email address</label>
      <input class="form-control" id="exampleInputEmail1" placeholder="Enter email" type="email">
    </div>
    <div class="form-group">
      <label class="control-label" name="phonenumber">Home Phone Number</label>
      <input class="form-control" type="text" placeholder="Phone Number">
    </div>
    <div class="form-group">
      <label class="control-label" name="address">Full Address</label>
      <input class="form-control" type="text" placeholder="Address">
    </div>
    <div class="form-group">
      <label class="control-label">Town/City</label>
      <input class="form-control" type="text" placeholder="Town">
    </div>
    <div class="form-group">
      <label class="control-label" namme="country">Country</label>
      <input class="form-control" type="text" placeholder="Country">
    </div>
    <div class="form-group">
      <label class="control-label" contenteditable="true" name="postcode">Postcode</label>
      <input class="form-control" type="text" placeholder="PostCode">
    </div>
    <div class="form-group">
      <label class="control-label" name="payment">Payment Method</label>
      <input class="form-control" type="text" placeholder="e.g MasterCard, Visa">
    </div>
    <div class="form-group">
      <label class="control-label" name="expiry">Expiry Date</label>
      <input class="form-control" type="text" placeholder="e.g 06/18">
    </div>
    <button type="submit" class="btn btn-primary" name="submit" value="submit">Submit</button>
  </form>
&#13;
&#13;
&#13;

如果格式不正确,我们很抱歉,我是这个网站的新用户。任何建议或协助将不胜感激!干杯啦!

0 个答案:

没有答案