Support

Account

Home Forums General Issues Echo Form Field Values via $_POST

Solving

Echo Form Field Values via $_POST

  • Hey. I’m trying to create a preview of my front end form similar to this page.

    http://www.picssel.com/playground/jquery/postPreview_05Jun13.html

    My issues is that the $_POST values for the ACF fields are returning NULL.

    The post title returns correctly but not the custom fields.

    preview.php

    
    <?php
    
     echo "<p>Post Title:".$_POST["postTitle"]."</p>"; // This works
     echo "<p>Post Title:".$_POST["fields[field_51dbe34b78471]"]."</p>"; // This doesn't
    
    ?>
    

    Any suggestions on what I am missing?

    • Elliot

    • July 17, 2013 at 2:38 pm

    Hi @markkelly1982

    Always test data before asuming it exists.

    Test like this:

    
    <?php 
    
    echo '<pre>';
    	print_r($_POST);
    echo '</pre>';
    die;
    
    ?>
    
  • Hi.

    Yeah I had tried that and that’s where i got the NULL return from.

    Is there a function that I have to tie to my submit button to make the custom fields POST?

    • Elliot

    • July 18, 2013 at 2:37 pm

    Perhaps the issue is the syntax error in your code.

    
    echo "<p>Post Title:".$_POST["fields[field_51dbe34b78471]"]."</p>"; // This doesn't
    

    should be

    
    echo "<p>Post Title:".$_POST["fields"]['field_51dbe34b78471']."</p>"; // This doesn't
    
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.