2016-05-23 6 views
0

私は、ボタンが押されたときにデータベースにデータを挿入するはずの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>"; 
    } 



} 
+3

**危険**:あなたは[SQLインジェクション攻撃]に対して脆弱**あります(http:/ /bobby-tables.com/)**あなたが[守る]必要がある(http://stackoverflow.com/questions/60174/best-way-to-prevent-sql-injection-in-php)からあなた自身。 – Quentin

+1

ロギングを追加します。 'if'文は入力されますか? '$ _POST ['button1']'にはどのような価値がありますか? – Quentin

+0

あなたの質問は二重引用符で囲まれていません。 –

答えて

0

あなたはサーバーにボタンを送信していません。唯一のデータフィールド

例えば:

HTML

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

PHP

if(isset($_POST['sendData'])) { 
    $fieldname = $_POST['sendData']['fieldname']; 
} 
関連する問題