I have a WordPress site that I am using a gravity form. I would like to take one of the gravity forms I am using and insert the data into another table. (Besides the gravity form table). I am using the Gravity Form after submission hook to grab the values of my specific form (3) and run a SQL statement. Here is a link explaining about the hook: http://www.gravityhelp.com/documentation/page/Gform_after_submission
However, nothing gets inserted into the new table (users). I can't even tell if the script is running. Both the "default" gravity form table and my new users table are in the same database. Here's what my PHP looks like:
add_action("gform_after_submission_3", "input_fields", 10, 2);
function input_fields($entry, $form){
$entry["1"] = '$name';
$entry["2"] = '$email';
$entry["3"] = '$purchase_date';
$entry["4"] = '$order_number';
$SQL = "INSERT INTO users ( userID, email, name, purchase_date, order_number) VALUES ( '', '$email' , '$name', '$purchase_date', '$order_number')";
}
I'm grabbing the values using the Gravity Form entry object. More info about that here: http://www.gravityhelp.com/documentation/page/Entry_Object
The form writes to the default table alright but not to my new "users" table. Any suggestions? Let me know if I need to give more info. Thanks for any help!
You have created the query but you are not executing it.
Also I assume that you have already created the users table.
Try this following code...
Thank you....