Guest User

Untitled

a guest
Jul 14th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. <?php
  2. // Database Connection Details //
  3. $db_host = 'localhost';
  4. $db_user = 'root';
  5. $db_pass = 'apriljoey';
  6. $db_name = 'webform';
  7.  
  8. // Database Connection //
  9. $db_connect = mysqli_connect($db_host, $db_user, $db_password, $db_name)
  10. or die('Error connecting to the database. See datainsert.php.');
  11.  
  12. $sql = "INSERT INTO webtable(Trans_Time, Trans_date, Agent_Name, National_Grid_Account_no, Con_Edison_Account_no, Name_on_Bill, Contact_Person, Address, Phone_no, Notes)
  13. VALUES('$_POST[txtTime]','$_POST[txtDate]', '$_POST[txtAgent]', '$_POST[txtNationalGrid]', '$_POST[txtConEdison]','$_POST[txtNameBill]', '$_POST[txtContactPerson]', '$_POST[txtAddress]','$_POST[txtPhone]','$_POST[txtNotes]')";
  14.  
  15. $result = mysqli_query($db_connect, $sql)
  16. or die('Error adding data to database. Check datainsert.php');
  17.  
  18. if($result == true) echo 'Successfully added information to database!';
  19.  
  20. mysqli_close($db_connect);
  21. ?>
  22. <html>
  23. <form action = "webform.php"/>
  24. <input type = "submit" name = "cmd" values = "Back to Homepage to Input another record."/>
  25. </form>
  26. </html>
Add Comment
Please, Sign In to add comment