Need help with the back end for my contact form

Hello,

I am new to php and am looking to get some help with my contact form. I have a javascript file that validates the information and then uses the jQuery.post() method to send an email when all required fields are validated. I have no problem in the front end but am totally clueless on how to store the data and send it to my email. Can anyone please take a look? I have also looked at bastianallgeier’s contact form example for kirbycms https://gist.github.com/bastianallgeier/c396df7923848912393d but I cannot code in php like i can with javascript so that’s why i decided to go this route.

My contact form can be found here - https://jsfiddle.net/wxusdczq/

the place where i’m stuck on is on line 117 of the javascript section

$.post("contact/hello-send" (not sure what to put here), post_data, function(e) {
            showResult();
            $("#hello_form input").val("");
            $("#hello_form textarea").val("")
        }).fail(function(e) {
            $("#result-hello").hide().html('<div class="error">' + e.statusText + "</div>").fadeIn(200)
        })

Anything would help!

Maybe this cookbook recipe can help you a little. Please keep in mind that it is not enough to validate data on the frontend, but you have to validate it on the server as well before storing it.

1 Like