Home>Support>Unable to insert form data into wordpress database in Vantage premium theme

Unable to insert form data into wordpress database in Vantage premium theme

Hi,

I have created a tabbed customize-page. In that, I have multiple forms on single page in different tabs. I am trying to insert data into wordpress database where I have created table “wp_form_user”. But nothing is being inserted. I request to please help me. I am not getting any error.
I have all these files in vantage-child theme folder.

custom_page.php

</div>
    	<!-- added content ends -->
        <div id = "sidebar1" class="sidebar">
            Please answer the following Questions


			<form action="http://ifast.uic.edu/index.php/successpage/" method ="post" name="tab1_form">
			  1. What are the key mathematical concepts?<br>
			  <textarea rows="2" cols="30" id = "tab1_ans1" name="tab1_ans1"></textarea>
			  <br><br>
			  2. How might students solve the problem? (2+ ways)<br>
			  <textarea rows="2" cols="30" id = "tab1_ans2" name="tab1_ans2" ></textarea>
			  <br><br>
              3. How do we reduce time spent on this part of the task?<br>
              <textarea rows="2" cols="30" id = "tab1_ans3" name="tab1_ans3" ></textarea>
              <br><br>
              4. What important misconceptions may arise?<br>
              <textarea rows="2" cols="30" id = "tab1_ans4" name="tab1_ans4"></textarea>
              <br><br>
			  <input type="submit" value="submit" name="submit">
			</form> 

        </div>

action_page.php


<?php
/**
 * Template Name:Php success page
 * The template for displaying all pages.
 *
 * This is the template that displays all pages by default.
 * Please note that this is the WordPress construct of pages
 * and that other 'pages' on your WordPress site will use a
 * different template.
 *
 * @package vantage
 * @since vantage 1.0
 * @license GPL 2.0
 */

    require( dirname(__FILE__) . '/wp-config.php' );
    require( dirname(__FILE__) . '/wp-load.php' );


    
            //if (!empty($_POST)) {
            global $wpdb;
            echo 'here';
            $wpdb->insert( 'wp_form_user', array(
                'q1_value'    => 'q',
                'q2_value'    => 'd',
                'q3_value'    => 'd',
                'q4_value'    => 'f',
                'q5_value'    => 's') ,
                array('%s','%s','%s','%s','%s'));
            // if($success){
            // echo 'data has been save' ; 
            // }
//}
 ?>
<!-- script to insert data starts here-->

when I am getting echo post content, But I am not able to insert content. So tried to hardcode the values but still nothing is being inserted. I tried to replace with

require_once(‘../../../wp-config’) but its not working. So almost all the solutions given online, i tried. I have changed format an removed the format option. So its not working. I would appreciate any help. As I am new to wordpress, I can’t imagine anything.

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 8 years, 5 months ago Andrew Misplon
    Hi, I Work Here

    Hi Ruchi

    Thanks for reaching, sorry we weren’t able to reply sooner.

    We do our best to assist with small customization requests. Unfortunately, this request is beyond the scope of questions we’re able to assist with here on the forum. If you’d like to consider developer level assistance, we recommend the team over at Codeable.

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More