• Hey guys,

    I’ve tried to find an answer to my issue for about 6 hours now, trying multiple methods, with no luck. Basically I just need to (via a custom form), post the variables to the same template page, and update a table that I’ve created in the database I’m using. The logic is so simple, yet I cannot figure out how to do this. The script happens after the header, here is the code I’m using:

    global $wpdb;
    
    $wpdb->insert( 'askaquestion', array( 'id' => '', 'name' => $_POST['thename'], 'email' => $_POST['email'], 'question' => stripslashes($_POST['question'])  ) );

    Anyone have any insight into this little problem I’m having?

  • The topic ‘Insert new database row into custom table’ is closed to new replies.