Advertisement
demetriusPop

Insert w/o function

Dec 8th, 2013
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4.  
  5. Template Name: myTemp
  6.  
  7. */
  8.  
  9.  
  10.  
  11.  
  12.  
  13. global $wpdb;
  14.  
  15.  
  16. if ( isset( $_POST['address'] ) && $_POST['address'] != '') {
  17. $address = $_POST['address'];
  18. }
  19.  
  20. // grab the table if exist or build and store in var
  21. $address_table = $wpdb->prefix . "address_table";
  22.  
  23. $wpdb->insert($address_table, array('address' => $address),array('%s'));
  24.  
  25.  
  26. if( isset($address) && $address != '' ) {
  27.  
  28. echo 'Thank you, address has been submitted';
  29.  
  30. }
  31. ?>
  32.  
  33. <form method="post" action="" id="insertForm" name="insertForm">
  34. <input type="text" value="" placeholder="enter text" id="address" name="address">
  35. <input type="submit" value="submit">
  36. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement