Advertisement
tcelestino

Salvando dados de um form no banco

Jan 30th, 2012
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.42 KB | None | 0 0
  1. <?php
  2.   global $wpdb;  
  3.   require('../../../wp-blog-header.php');
  4.  
  5. if(isset($_POST)) {
  6.     $nome = $_POST['nome'];
  7.     $email = $_POST['email'];
  8.  
  9.     $statusPost = "draft";
  10.    
  11.     $query = "INSERT INTO $wpdb->posts (post_title, post_status, post_type) VALUES (%s, %s, %s)";
  12.     $wpdb->query($wpdb->prepare($query, $nome, $statusPost, 'slug_cpt'));
  13.  
  14.     $postid = $wpdb->insert_id;
  15.     update_post_meta($postid, '_email', $email);   
  16. }
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement