Home › Forums › Quform WordPress › Sending Form Data to Script
- This topic has 1 reply, 2 voices, and was last updated 11 years, 9 months ago by Ally.
- AuthorPosts
- February 5, 2013 at 9:04 pm #2659lawrencepepperParticipant
Following the help instructions I have edited my functions.php file to have some form data sent from one of my forms to a php script. It works great.
The problem is I need a number of these for different forms through the site. When I add another function to the functions.php file though it crashes the site with a 500 error. How can I do multiple functions of this:
function mytheme_post_to_another_script($form)
{
// Rewrite the post variables
$post = array(
'vendor' => $_POST['iphorm_3_3'], // Change iphorm_X_X to vendor field unique ID
'newvendor' => $_POST['iphorm_3_7'], // Change iphorm_X_X to new vendor field unique ID
'rep' => $_POST['iphorm_3_8'], // Change iphorm_X_X to rep field unique ID
'delete' => $_POST['iphorm_3_11'], // Change iphorm_X_X to delete field unique ID
);// Create a new cURL resource
$ch = curl_init();// Set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, 'xxx');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));// Grab URL and pass it to the browser
curl_exec($ch);// Close cURL resource, and free up system resources
curl_close($ch);
}
add_action('iphorm_post_process_3', 'mytheme_post_to_another_script', 10, 1);
February 6, 2013 at 12:37 pm #2671AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.