Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- wp_enqueue_script('jquery');
- function addCustomer(){
- global $wpdb;
- $name = $_POST['name'];
- $phone = $_POST['phone'];
- $email = $_POST['email'];
- $address = $_POST['address'];
- if($wpdb->insert('customers',array(
- 'name'=>$name,
- 'email'=>$email,
- 'address'=>$address,
- 'phone'=>$phone
- ))===FALSE){
- echo "Error";
- }
- else {
- echo "Customer '".$name. "' successfully added, row ID is ".$wpdb->insert_id;
- }
- die();
- }
- add_action('wp_ajax_addCustomer', 'addCustomer');
- add_action('wp_ajax_nopriv_addCustomer', 'addCustomer');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement