WordPress.org

Forums

[resolved] How to pass a variable by get method in self page? (11 posts)

  1. erfan_atp
    Member
    Posted 1 year ago #

    Hi, I have a form that its action is null (action="") and my php codes are below of my page, not in another page. So I want to pass a variable by get method in this page after my php codes done?
    You know that the page will reload after my functions.

  2. Christian1012
    Member
    Posted 1 year ago #

    What specifically is your question. How to pass an url parameter?

  3. erfan_atp
    Member
    Posted 1 year ago #

    no! I use header("location:/index?type=true") but it doesn't appear in my url. it doesn't compile header function.

  4. Andrew
    Forum moderator
    Posted 1 year ago #

    Have you seen the documentation? http://www.php.net/manual/en/function.header.php

  5. erfan_atp
    Member
    Posted 1 year ago #

    sure!!! I used it before, in a php code. but in wordpress it doesn't work.
    My Main problem:
    I have a form in a custom template and when it submitted, I want to show to user : 'Your request submited'.

  6. Andrew
    Forum moderator
    Posted 1 year ago #

    So can you just use the "action" in the form element?

  7. erfan_atp
    Member
    Posted 1 year ago #

    No, I just return a true value to my form to show to user, any way

  8. Andrew
    Forum moderator
    Posted 1 year ago #

    Can you pastebin all relevant code?
    http://pastebin.com

  9. erfan_atp
    Member
    Posted 1 year ago #

    summary of my code:
    here

  10. Christian1012
    Member
    Posted 1 year ago #

    You can't send headers or or sessions after your output to the browser. You need to either use an output buffer, or put that code at the top of the page before you output anything to the browser.

  11. erfan_atp
    Member
    Posted 1 year ago #

    tnx Christian1012, Done!

Topic Closed

This topic has been closed to new replies.

About this Topic