Submit Button not Sending – PHP – SitePoint Forums

Hi people.
This is my 1st try at making a kind. Unfortunately I’m struggling to get it working.
The kind itself works nice, simply not the ship half.
I’ve tried to comply with different varieties from different boards as finest I can, however I’m lacking one thing.
I’ve messed about with:

Here I’ve seperated the varieties.
I did have

I’ve added and eliminated the PHP tags. I’ve additionally performed round with by shifting them to numerous areas.

The code I’ve for the time being is:


You can use this type to contact us

Sorry if I’m making novice errors.
If anybody can level me in the fitting course.

You ought to solely have one kind tag.

Is the code for sending the e-mail in a separate PHP file, and is it named suitably? You quote the motion as “contactform” – shouldn’t that be “contactform.php”?

As for really sending the e-mail, a lot of business e mail servers received’t simply ship emails “from” the deal with that your consumer typed into the discussion board. A correct e mail server might be configured to solely ship emails from a site that it’s alleged to be sending from, in any other case it’s a factor known as “Open Relay” which is A Bad Thing. Use an e mail deal with that you’ve configured the server to assist, and use the “reply-to” header if you wish to make it simpler to answer.

I also needs to point out that the constructed-in PHP mail() operate isn’t thought of to be a great way of sending e mail, it’s best to take a look at a library corresponding to PHPMailer. That is likely to be significantly wanted in case you’re utilizing gmail as your mail server, as that can want a safe connection on an alternate port. Is your growth system configured appropriately to assist sending emails?

As talked about, you kind factor(s) is mistaken. Have only one kind factor with all of the attributes in it.

Aside kind that, there are issues that may very well be executed otherwise.
You can’t depend on shopper facet validation alone, it ought to be backed up by server facet validation too.
I might most likely put off the js validation, as staple items like that at the moment are constructed into browsers in case you use the proper attributes within the inputs, such because the required key phrase. That will depart you to focus on the server facet validation.

It appears like you’ve gotten the PHP kind processing in with the HTML from web page. That is doable, however in case you do it, do it otherwise. Put the PHP at first of the file, earlier than any HTML and wrap the processing in a situation, to solely hearth on submission:-

In this fashion you don;t even want the motion attribute, as it’ll default to itself.
It additionally implies that if a submission fails the server facet validation, you may return the consumer to the shape and checklist the errors they made.
A profitable submission will be redirected to a hit web page through headers.

Thanks guys on your assist.
As stated I’m a complete novice on this, so I’ll be some time attempting get my head spherical your options.

I’ll report again as soon as I’ve had in the past, most likely with extra points.

Related Posts