Sending Form Data to Script

Home Forums Quform WordPress Sending Form Data to Script

This topic is: not resolved

This topic contains 1 reply, has 2 voices, and was last updated by  Ally 6 years, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2659

    lawrencepepper
    Participant

    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);

    #2671

    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

Be inspired. © 2019 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy