Advertisement
Guest User

Untitled

a guest
Jul 14th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. <?php acf_form_head(); ?>
  2. <?php /* Template name: Test */ get_header(); ?>
  3. <?php
  4. $servername = "servername";
  5. $username = "user";
  6. $password = "pass";
  7. $dbname = "name";
  8.  
  9. // Create connection
  10. $conn = mysqli_connect($servername, $username, $password, $dbname);
  11.  
  12. // Check connection
  13. if (!$conn) {
  14. die("Connection failed... " . mysqli_connect_error());
  15. }
  16.  
  17. $FirstName = $_POST["fields"]['acf[field_5968834df2ac1]'];
  18.  
  19. if(isset($_POST['submit']))
  20. {
  21.  
  22. $sql = "INSERT INTO DBNAME (Roepnaam) VALUES ('$FirstName')";
  23. if ($conn->query($sql) === TRUE) {
  24. echo "";
  25. } else {
  26. echo "Error: " . $sql . "<br>" . $conn->error;
  27. }
  28. }
  29.  
  30. ?>
  31.  
  32. <div id="primary" class="content-area">
  33. <div id="content" class="site-content" role="main">
  34.  
  35. <?php /* The loop */ ?>
  36. <?php while ( have_posts() ) : the_post(); ?>
  37.  
  38. <?php acf_form(array(
  39. 'post_id' => 'new_post',
  40. 'new_post' => array(
  41. 'post_type' => 'db_test',
  42. 'post_status' => 'publish'
  43. ),
  44. 'submit_value' => 'Create a new event'
  45. )); ?>
  46.  
  47. <?php endwhile; ?>
  48.  
  49. </div><!-- #content -->
  50. </div><!-- #primary -->
  51. <?php get_footer(); ?>
  52.  
  53. <form id="acf-form" class="acf-form" action="" method="post">
  54. <div class="acf-fields acf-form-fields -top">
  55. <div id="Firstname" class="acf-field acf-field-text acf-field-5968834df2ac1 voornaam" style="width:40%;" data-name="voornaam" data-type="text" data-key="field_5968834df2ac1" data-width="40">
  56. <div class="acf-label">
  57. <label for="acf-field_5968834df2ac1">Voornaam</label>
  58. </div>
  59. <div class="acf-input">
  60. <div class="acf-input-wrap"><input type="text" id="acf-field_5968834df2ac1" class="" name="acf[field_5968834df2ac1]" value="" placeholder="" /></div> </div>
  61. </div>
  62. </div>
  63. <div class="acf-form-submit">
  64. <input type="submit" class="acf-button button button-primary button-large" value="Create a new event" /> <span class="acf-spinner"></span>
  65. </div>
  66. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement