• Resolved foochuck

    (@foochuck)


    I’ve created a WordPress page with a basic form. It accepts someone’s width, height & weight and then is supposed to pass that data via post to another WordPress page on my site. I’m using page templates so that I can add the PHP needed within the header, however the data doesn’t get passed.

    Are there any tricks or tips anyone could give me for passing just numbers via post within WordPress?

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Do you have a URL where the form is?

    Thread Starter foochuck

    (@foochuck)

    Here is the first page, the form is entered as html in the page content:

    Page 1 form: https://pastebin.com/Lk8kFZUC

    When the form is submitted, the post data is being sent to ‘page-results’, below is the PHP that’s above the header in my page reults

    Page 2 ‘page-results’: https://pastebin.com/mZmC4uXV

    The first problem is that when you submit the first page (which goes to localhost/page-results) – it takes you to the correct URL but it says page not found.

    If you load localhost/page-results without submitting the form it does open.

    Is there something special I need to setup in functions in order to pass POST data from one page to another using basic PHP methods?

    Hi,

    1) Try your action as action="https://localhost/page-results.php"
    2) What’s happening in the validateForm(); javascript you have on submit?

    If you’re passing the post data correctly you shouldn’t need to do anything special for it to work…

    Thread Starter foochuck

    (@foochuck)

    In case anyone comes across this with a similar issue, I found the problem. The variables I’m using in my form were interfering with WordPress’ permalinks. I changed my variables to have custom names and it resolved the issue.

    Hope this helps someone out down the line.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Basic PHP Script to Pass Post Varables’ is closed to new replies.