WordPress.org

Ready to get started?Download WordPress

Forums

Form Action HTML (9 posts)

  1. ComradeSmack
    Member
    Posted 6 years ago #

    A new problem for today. I'm trying to imbed some HTML forms on a WP Page.

    <table align="center" border="0" width="75%">
    <form action="http://www.xxx.com/action.php" method="POST">
    <tr>
    <td>Name</td>
    <td><input name="from_name" size="30" maxlength="100" type="text" /></td>
    </tr>
    </table>

    However, none of the variables (there are 10, not just the one shown above) seem to work. The culprit seems to be revolving around the <form action> bit not working, since it's not there whenever I re-edit the page.

    Is there a reason why WP seems to be removing it?

  2. moshu
    Member
    Posted 6 years ago #

    Are you adding your code to the wysiwyg (visual) editor?
    You should never do that. If you want to input your own code - TURN OFF the visual (admin > Users > Your profile).

    Btter yet, for forms and other more complicated code... you should use a custom Page Template and put the code in it.
    see more: Pages.

  3. ComradeSmack
    Member
    Posted 6 years ago #

    I'm definitely not putting it in the visual bit, I'm not that halfwit.

    I never thought of doing a custom page template, though...

    Is there any other reason why it would strip out that one line?

  4. moshu
    Member
    Posted 6 years ago #

    I'm definitely not putting it in the visual bit, I'm not that halfwit.
    Sorry, 9 out of 10 always do it :)

    I don't know why it doesn't like the form...

  5. ComradeSmack
    Member
    Posted 6 years ago #

    It still isn't working.

    Anyone else have any advice?

  6. clivesgt
    Member
    Posted 6 years ago #

    hi
    i am having a similar problem. i have a form on a wordpress page. the $_GET variable is the email address entered by the user. on clicking submit, the action page is called and the variable, email address should be passed but it is not. if i echo $_GET['email'], it is blank.

    i then create a link on the same page (where the form is) with a get variable - ?email=emailAddress. when this link is clicked, the same page as per action in the form is called and the get variable passed. this time the variable is there and is displayed with the echo $_GET['email'].

    i would very much appreciate it if someone could let me know how to ensure that the $_GET variable is passed successfully from the form.

    thanks in advance

    regards
    clive

  7. whooami
    Member
    Posted 6 years ago #

    gets are not sent typically sent via forms, posts are. a get request would be sent in the url string, ie

    http://www.blah.com?name=google

    have you defined the method as a a get?

  8. clivesgt
    Member
    Posted 6 years ago #

    hi

    i need to send it as a GET. yes i have defined the method as a get. i am using an htm file (which has the form) which i include in the wordpress page. the file works perfectly (the email address is sent and received by another PHP file outside of wordpress) when i use the htm file via the wordpress page, it does not work.

    i have since realised that it has something to do with the permalink structure as i set the permalink to default and it works perfectly in wordpress. i noticed that when using the permalink structure that i previously had, it would append "extra stuff" to the url. anyhow, it seems that my problem is solved - i just need to fine tune my permalinks.

    thanks

    cheers

  9. nicolas.darnis
    Member
    Posted 5 years ago #

    I've got the same problem. I found your post that helped me to solve my problem. The only difference, is I use POST method and so, the $_POST variable to retrieve successfully input data.

    So I think it could work for you, if you replace 'method="POST"' by 'method="GET"' in your form definition.

Topic Closed

This topic has been closed to new replies.

About this Topic