Tasos Kakouris
Tasos Kakouris

Reputation: 175

ContactForm 7 and javascript to capture form data

I have a WordPress site and i use a cf7 form to make a booking enquiry. When the form is submitted an email is send to my info@.. and also a custom php file i made is passing data from the form to a CRM platform.

I use JS on_mail_sent action and i capture all the values of the form and im passing it to the php file via query (.php?id=id&......).

I want to ask if this method is acceptable or i must use another method. For example is there any way certain browsers for some reasons dont support javascript?

Thank you.

Upvotes: 2

Views: 459

Answers (1)

Viktor
Viktor

Reputation: 827

The better solution to use POST method to submit form. About difference between Get and Post:

GET requests a representation of the specified resource. Note that GET should not be used for operations that cause side-effects, such as using it for taking actions in web applications. One reason for this is that GET may be used arbitrarily by robots or crawlers, which should not need to consider the side effects that a request should cause.

POST submits data to be processed (e.g., from an HTML form) to the identified resource. The data is included in the body of the request. This may result in the creation of a new resource or the updates of existing resources or both.

HTTP/1.1 specification (RFC 2616) section 9 Method Definitions contains more information on GET and POST as well as the other HTTP methods.

One more important moment:

Authors of services which use the HTTP protocol SHOULD NOT use GET based forms for the submission of sensitive data, because this will cause this data to be encoded in the Request-URI. Many existing servers, proxies, and user agents will log the request URI in some place where it might be visible to third parties. Servers can use POST-based form submission instead.

All popular browsers supports Javascript.

Regards.

Upvotes: 1

Related Questions