Passing form data to a PHP file on my server

  • Joseph
    Asked on February 26, 2021 at 4:02 AM

    I want to create an interactive form where users upload a file and enter some parameters. The data is then passed to a php file on my server and processed via a command line interface. I want results from the command line to be passed back to the user on the same form where they will have an option to close the form or place an order.

    How can I achieve this?

  • Niko_N
    Replied on February 26, 2021 at 7:06 AM

    Greetings Joseph,

    You can send submissions data to your PHP file via the post method:

    Send Submission Data via Post Method and Thank You Settings

    However, this is only possible once the form is submitted. If you need the same form to be continued with the same data and some additional information from your command line, you may then send all the form data using that post method, process, and use your command line to prepopulate the same form again:

    Prepopulating Fields to Your JotForm via URL Parameters

    Please also note that if you want to make some calculations with the user's data on your server, you may use our Conditional Logic feature and Form Calculation widget instead:

    How to Perform Form Calculation Using a Widget

    Smart Forms: Conditional Logic for Online Forms

    Please check and let us know if you have further questions.

    Thank you!

  • Kurebwa
    Replied on February 28, 2021 at 12:53 PM

    I am trying the Send Submission Data via Post Method and Thank You Settings method on form 210563090581552 and I keep getting a blank array. Where am I going wrong? Here is my PHP code:

    <!DOCTYPE html>

    <html>

        <body>

            <?php

                // collect value of input field

                $layer_height = $_POST['layerthickness'];

                $wall_thickness = $_POST['shellthickness'];

                $infill_parse_density = $_POST['infilldensity'];

                $part_file = $_POST['fileupload'];


                echo $layer_height;

                echo $wall_thickness;

                echo $infill_parse_density;

            ?>

        </body>

    </html>

  • Mike_G JotForm Support
    Replied on February 28, 2021 at 6:54 PM

    To fix the issue you are having, kindly try the following codes, please?

    <!DOCTYPE html>
    <html>
    <body>
    <?php
    $layer_height = $_POST["layerthickness33"];
    $wall_thickness = $_POST['shellthickness34'];
    $infill_parse_density = $_POST['infilldensity35'];
    $part_file = $_POST['fileupload'][0];


    echo $layer_height;
    echo "<br>";
    echo $wall_thickness;
    echo "<br>";
    echo $infill_parse_density;
    echo "<br>";
    echo $part_file;
    ?>
    </body>
    </html>

    These should follow the Field Name of the fields in your form.

    $layer_height = $_POST["layerthickness33"];

    $wall_thickness = $_POST['shellthickness34'];

    $infill_parse_density = $_POST['infilldensity35'];

    $part_file = $_POST['fileupload'][0];

    1614553437 603c215d69192 zt210228 180326 Screenshot 10

    Note: Capital letters are ignored.

    Reference Guide: How-to-Find-Field-IDs-and-Names

    Please give it a try and let us know if you need any further assistance.