PHP表单未插入

时间:2016-05-23 19:52:40

标签: php

我有一个php表单,当按下按钮时,它应该将数据插入我的数据库。但它什么都不做,没有错误,我也不知道为什么。请帮助我多次通过我的代码,但我看不到问题

 if(isset($_POST['button1'])){
    //geting text data from the feilds
    $applicatioID = $_POST['applicaionid'];
    $postionaplied = $_POST['postionaplied'];
    $weight = $_POST['weight'];
    $fullname = $_POST['fullname'];
    $persontel = $_POST['persontel'];
    $height = $_POST['height'];
    $age = $_POST['age'];
    $brithdate = date("Y-m-d", strtotime($_POST['brithdate']));
    $placeofbirth = $_POST['placeofbirth'];
    $fathernamee = $_POST['fathernamee'];
    $mothername = $_POST['mothername'];
    $nationality = $_POST['nationality'];
    $passportnumber = $_POST['passportnumber'];
    $placeofisue = $_POST['placeofisue'];
    $issudate = date("Y-m-d", strtotime($_POST['issudate']));
    $expirydate = date("Y-m-d", strtotime($_POST['expirydate']));
    $passportcopy = $_FILES['passportcopy']['name'];
    $applcaphoto = $_FILES['applcaphoto']['name'];
    $institue1 = $_POST['institue1'];
    $course1 = $_POST['course1'];
    $year1 = date("Y-m-d", strtotime($_POST['year1']));
    $institue2 = $_POST['institue2'];
    $corse2 = $_POST['corse2'];
    $year2 = date("Y-m-d", strtotime($_POST['year2']));
    $institue3 = $_POST['institue3'];
    $corse3 = $_POST['course3'];
    $year3 = date("Y-m-d", strtotime($_POST['year3']));
    $company1 = $_POST['company1'];
    $emppostion1 = $_POST['emppostion1'];
    $empyear1 = date("Y-m-d", strtotime($_POST['empyear1']));
    $company2 = $_POST['company2'];
    $emppostion2 = $_POST['empposion2'];
    $empyear2 = date("Y-m-d", strtotime($_POST['empyear2']));
    $company3 = $_POST['company3'];
    $emppostion3 = $_POST['emppostion3'];
    $empyear3 = date("Y-m-d", strtotime($_POST['empyear3']));
    $homelicense = $_POST['homelicense'];
    $gcclicesnse = $_POST['gcclicesnse'];
    $gcccountry = $_POST['gcccountry'];


    $insert_product= insert into applacions
 app_id,fullname,positionaplied,age,personaltel,dateofbirth,weightt,height,place,nationality,fathername,mothername,passportname,issueplace,issudate,expirdate,pas   sportcopy,aplicantphoto,institution1,course,complitionyear,institution2,course2,complitionyear2,
              institution3,course3,complitionyear3,company,postion,endyear,company2,postion2,e                 ndyear2,homelicense,gcclicense,gcccountry,interviewcomt,applicaiondate

  )VALUES('$applicatioID','$fullname','$postionaplied','$age','$persontel','$brith            date','$weight','$height','$placeofbirth','$nationality','$fathernamee','$mother       name','$passportnumber','$placeofisue','$issudate','$expirydate','$passportcopy','$applcaphoto','$institue1','$course1','$year1','$institue2','$corse2','$year2','$institue3','$corse3','$year3','$company1','$emppostion1','$empyear1','$company2','$emppostion2','$empyear2','$company3','$emppostion3','$empyear3','$homelicense','$gcclicesnse','$gcccountry',NOW());

 if($run_query = mysqli_query($conn,$insert_product)){
        echo"<script>alert('product Has been Inserted')</script>";
        echo"<script>window.open('application.php','_self')</script>";
    }



}

1 个答案:

答案 0 :(得分:0)

您不是向服务器发送按钮。只有数据字段

例如:

HTML

<form>
  <input type="text" name="sendData[fieldname]">
  <input type="submit">
</form>

PHP

if(isset($_POST['sendData'])) {
    $fieldname = $_POST['sendData']['fieldname'];
}