发布到数据库中

时间:2016-11-12 22:44:44

标签: php mysql forms post

拜托,我刚开始进行php编程,我有一个项目来构建一个电子商务网站,发布到我的客户数据库中我使用以下代码

 <?php
    $connect = mysqli_connect("localhost","root","","shopping") or die
    ("Please,check the server connection.");
    $email_address= $_POST['email_address'];
    $password= $_POST['pass'];
    $repassword = $_POST['repassword'];
    $firstname= $_POST['first_name'];
    $lastname= $_POST['last_name'];
    $address1 = $_POST['address1'];
    $address2 = $_POST['address2'];
    $city = $_POST['city'];
    $state = $_POST['state'];
    $country = $_POST['country'];
    $school = $_POST['school'];
    $tel = $_POST['telno'];

     $sql = "INSERT INTO customer (email_address, pass, first_name,last_name,address1, address2,
city, state, school, country, telno)
     VALUES ('$email_address',(PASS('$password')), '$firstname', $lastname', '$address1',
'$address2', '$city', '$state', '$school', '$country', '$tel')";
      $result = mysqli_query($connect, $sql) or die(mysql_error());
      if ($result)
      {

    <p>
    Dear,  echo $firstname;  your account is successfully created

    }
    else
    {
    echo "Some error occurred. Please use different email address";
    }
    ?>

但它一直告诉我每个帖子变量的未定义索引,请问我该怎么做?

0 个答案:

没有答案