Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End PHP not Getting Processed

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #150947

    Hi I have set up my php contact form in my assets/includes folder it is a jquery contact form as well as php. assets/config is where i put my email address and then contact-process.php runs it and the functions.php.

    php page only have the jquery side of this

    <!-- CONTACT FORM SCRIPT -->
    <script type="text/javascript">
    
    $(document).ready(function ()
    { // after loading the DOM
        $("#ajax-contacts").submit(function ()
        {
            // this points to our form
            var str = $(this).serialize(); // Serialize the data for the POST-request
            $.ajax(
            {
                type: "POST",
                url: '<?php echo get_template_directory_uri(); ?>assets/includes/contact-process.php',
                data: str,
                success: function (msg)
                {
                    $("#note").ajaxComplete(function (event, request, settings)
                    {
                        if (msg == 'OK')
                        {
                            result = '<div class="alert alert-success">Message was sent to website administrator, thank you!</div>';
                            $("#fields").hide();
                        }
                        else
                        {
                            result = msg;
                        }
                        $(this).html(result);
                    });
                }
            });
            return false;
        });
    });
    
    </script> 
    
    <form id="ajax-contacts" class="">
                    <fieldset>
                        <div class="form-group">
                            <label for="name">Name</label><input class="form-control" type="text" name="name" value="">
                        </div>
                        <div class="form-group">
                            <label for="email">E-Mail</label><input class="form-control" type="text" name="email" value=""><br>
                        </div>
                        <div class="form-group">
                            <label for="subject">Subject</label><input class="form-control" type="text" name="subject" value=""><br>
                        </div>
                        <div class="form-group">
                            <label for="message">Comments</label><textarea class="form-control" name="message" rows="5" cols="25"></textarea><br>
                        </div>
                        <div class="form-group">
                            <label for="submit">&nbsp;</label><input class="btn btn-lg btn-info" type="submit" name="submit" value="Send Message">
                        </div>
                    <fieldset>
                </form>
                <!-- END CONTACT FORM -->
    
    #150949
    __
    Participant

    do you have a question?

    #150951

    Yes it is not sending to my email? I have tried to get it to work. but once click send goes to blank page but no email inbox

    #151058
    __
    Participant

    once click send goes to blank page but no email inbox

    That sounds like the form is actually submitting (i.e., not using your AJAX function). Since there is no action attribute on your form, it should be submitting to itself, so I would not expect a blank page (unless there was a fatal PHP error) – is the code you posted all the code on the page?

    As @mcjonst says, we would need to see the PHP code that is processing the form as well (contact-process.php). I would recommend making a gist on github.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Back End’ is closed to new topics and replies.