Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Build a Simple PHP Application Adding a Contact Form Creating Input Fields

Form doesn't recognize [ method="post" ]

Hi!

I'm trying to create a contact form in a website (in WordPress) but it never worked, not matter what I did. The thing is, I went to the basics and made a super simple form to test it:

<form>
        <input type="text">
        <input type="submit" value="Enviar">
</form>

I tested in two websites, the one I want to add the contact form (I'm going to call it Site A), and another that I'm just starting (Site B).

I noticed that if I submit this form if both Sites, the URL appears like this: http://site.com/contact/? (with the '?' at the end). And when I added the [method="post"] like this:

<form method="post">
        <input type="text">
        <input type="submit" value="Enviar">
</form>

In Site B the URL appeared without the '?' like this: http://site.com/contact

But in Site A continues to have the '?'... so I assume that in Site A the form is not recognizing the [method="post"] and I don't know why. Can anyone help me, please?

Because this problem is also making WordPress plugins (of contact form) don't work.

Thanks!

1 Answer

Hey Sofia, I'm sure you didn't notice, but the "example" link you use directs one to some... rather lascivious content. Just a SPOILER ALERT for any unsuspecting link-clickers out there.

As to your question, when you say that your WordPress contact form "never worked," what exactly does that mean? It's not submitting? It's not showing up at all?

Also, I don't understand your reasoning for your test... You say:

"But in Site A continues to have the '?'... so I assume that in Site A the form is not recognizing the [method="post"]"

Why do you assume this?

Ops! I'm sorry, I didn't think about it! Edited :)

I mean that it's not submitting, yes. I was trying to implement some javascript to display text if the user didn't enter the requested fields, and I noticed there was a problem because it didn't work.

I assume that because is the only change I made in the form and it was a different result in Site A vs. Site B (the '?' in the url)... and I removed and added the method='post' several times and it was always the same result... so, I'm thinking there is a problem with the method='post'. Maybe I'm wrong, but that is why I thought that...