0

I have created a custom form using shortcode widget for my page sidebar, but the form input wasn't saving to may wordpress database. Can anyone help me with this. Please see below my codes.

<?php

if ( isset( $_POST['submit'] ) ){

    global $wpdb;
   $lplifeinsurance_leads=$wpdb->prefix.'lplifeinsurance';

    $data=array(
        'quotes' => $_POST['quotes'], 
        'cover' => $_POST['cover'],
        'health' => $_POST['health'], 
        'provider' => $_POST['provider'],
        'birthdate' => $_POST['birthdate'],
        'gender' => $_POST['gender'], 
        'lname' => $_POST['lname'], 
        'address' => $_POST['address'],
        'number' => $_POST['number'], 
        'email' => $_POST['email'] );


     $wpdb->insert( $lplifeinsurance_leads, $data);
}

?>

1 Answer 1

0

Please try below code.

global $wpdb;
$wpdb->insert('$lplifeinsurance_leads',$data,array('%s','%s'));
1
  • Please explain that code snippet. Commented Aug 31, 2017 at 10:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.