No Description

addEvent.php 900B

1234567891011121314151617181920212223242526272829303132333435
  1. <?PHP
  2. //---------------
  3. // Connection to server and database
  4. //---------------
  5. $host = "localhost";
  6. $basedatos = "techos";
  7. $user = "pablo.puig1";
  8. $passw = "9NA3kSExI2fGE6eV";
  9. try{
  10. $connection = mysqli_connect($host, $user, $passw, $basedatos) or $error = 1;
  11. }
  12. catch(Exception $ex){
  13. print("Error connecting to database: ". $ex->getMessage()) and die();
  14. }
  15. ?>
  16. <?PHP
  17. $name = $_POST['name'];
  18. $Sdate = $_POST['Sdate'];
  19. $Edate = $_POST['Edate'];
  20. $Pcount = $_POST['Pcount'];
  21. $Plimit = $_POST['Plimit'];
  22. $Desc = $_POST['Desc'];
  23. $queryAddUser = "INSERT INTO events (name, start_date, end_date, participant_count, participant_limit, description) VALUES ('$name', '$Sdate', '$Edate', '$Pcount', '$Plimit', '$Desc')";
  24. mysqli_query($connection, $queryAddUser);
  25. // $stmtAdd = mysqli_prepare($connection, $queryAddUser);
  26. // mysqli_stmt_execute($stmtAdd);
  27. header("Location: eventsTable.php");
  28. exit();
  29. ?>