Jump to content

Stephenung

New Members
  • Posts

    1
  • Joined

  • Last visited

Stephenung's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. hi guys, i am new here and looking for help on build a form and php code to send to mysql database's table with multiple rows inserted and AUTO Increment id. here what i have tried, but i gues im not good at php coding: <body> <form name="input_primary" action="test5.php" method="post"> <font color="#000000"><strong>Customer Name</strong></font><input name="cust_name" type="text" /> <table width="100%" border="1px solid black" id="maintab"> <tr> <th scope="col">JOB ID</th> <th scope="col">Make/Model</th> <th scope="col">Serial/IMEI</th> <th scope="col">Faulty</th> <th scope="col">Reapir</th> <th scope="col">Accessory</th> <th scope="col">Condi</th> <th scope="col">Intern Note</th> <th scope="col">Status</th> <th scope="col">Date Add</th> </tr> <?php //Repeat element inside loop 5 times for($i=0;$i<5;$i++) { ?> <tr> <td> <input name="job_id[]" type="hidden" /> </td> <td> <input name="makemodel[]" type="text" size="20px" /> </td> <td> <input name="serial[]" type="text" size="20px" /> </td> <td> <input name="faulty[]" type="text" /> </td> <td> <input name="repair[]" type="text" /> </td> <td> <input name="accessory[]" type="text" size="20px" /> </td> <td> <input name="conditions[]" type="text" size="30px" /> </td> <td> <input name="intern_note[]" type="text" /> </td> <td> <input name="status[]" type="text" size="20px" /> </td> </tr> <?php } ?> </table> <input type="submit" value="Save results!" name="submit" /> </form> </body> and here is my PHP <?php include "storescripts/connect_to_mysql.php"; if (isset($_POST["job_id"])) $job= $_POST["job_id"]; if (isset($_POST["makemodel"])) $model = $_POST["makemodel"]; if (isset($_POST["serial"])) $serial = $_POST["serial"]; if (isset($_POST["faulty"])) $faulty = $_POST["faulty"]; if (isset($_POST["repair"])) $repair = $_POST["repair"]; if (isset($_POST["accessory"])) $accessory = $_POST["accessory"]; if (isset($_POST["conditions"])) $conditions = $_POST["conditions"]; if (isset($_POST["intern_note"])) $intern_note = $_POST["intern_note"]; if (isset($_POST["status"])) $status = $_POST["status"]; //$url = $_POST["url_target"]; $sql = "INSERT INTO Repair(`job_id`,`makemodel`,`serial`,`faulty`,`repair`,`accessory`,`conditions`,`intern_note`,`status`,`date_added`) VALUES('job','$model','$serial','$faulty','$repair','$accessory','$conditions','$intern_note','$status', now())"; ?> When i submit the button, nothing heppen, no errors and no data create in my mysql table at all. can anyone help me with this? thanks in advanced Stephen
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.