• Resolved fvila789

    (@fvilawp)


    Hi,
    I entered a form in my template page as follows:

    <?php
    $sc =  '[fu-upload-form class="your-class" title="1) Upload your Travel photographs"]';
    $sc .= '[input type="file" name="photo" id="ug_photo" class="required" description="" multiple="true"]';
    $sc .= '[input type="text" name="destinationField" id="destinationField" class="required" description="<h2 class=destination>2) Type your Destination here:</h2>" ]';
    $sc .= '[input type="submit" class="btn" id="submission" value="3) Let MyTravelLog build Your Blog!"]';
    $sc .= '[/fu-upload-form]';
    echo do_shortcode($sc);
    ?>

    In the resulting page, I see the “destination” input field, it looks like this in the html:
    <input type="text" class="required" id="destinationField" name="destinationField" value="">

    BUT after entering data in the field and submitting, in Netbeans I see:
    * nothing in the $_POST variable in $Superglobals
    * nothing in $_GET apart from from post_type, p and response (default frontend fields).

    Attempt at solving: after reading another support issue, I tried adding this to functions.php:

    /* from https://www.ads-software.com/support/topic/unable-to-view-content-placed-in-custom-fields?replies=5*/
    add_action( ‘init’, ‘my_add_metaboxes’ );
    function my_add_metaboxes() {
    add_post_type_support( ‘attachment’, array( ‘destinationField’ ) );
    }

    https://www.ads-software.com/plugins/frontend-uploader/

Viewing 1 replies (of 1 total)
  • Thread Starter fvila789

    (@fvilawp)

    OK so found the solution to this.
    In fact by the time Frontend Uploader has finished its work and returned to the page, the $_POST variable has been stripped. The way to do it is to include the following in the functions.php of the theme:

    add_action( 'fu_after_upload', 'my_fu_after_upload', 10, 3 );
    
    function my_fu_after_upload( $attachment_ids, $success, $post_id ) {
    // do something with $_POST['destinationField'];
    // at this level, $_POST still has data in it
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Input field visible, but no data in $_POST’ is closed to new replies.