What's new

Welcome to the forum 👋, Visitor

To access the forum content and all our services, you must register or log in to the forum. Becoming a member of the forum is completely free.

PHP Contact Form: Making Confirmation Appear above Form.

chome4

New member
Joined
Jun 7, 2019
Messages
2
Reaction score
0
HTML Coins
0
I have a perfectly working PHP contact form, shown below. My issue is how to change the code so that the confirmation will appear above the form. Instead, after the form has been filled in, the confirmation is printed on a new, blank page. Still learning php but have been struggling with this one!

Hope someone can help.

Cheers....

Code:
<?php
    $msg = "";
    use PHPMailer\PHPMailer\PHPMailer;
    include_once "PHPMailer/PHPMailer.php";
    include_once "PHPMailer/Exception.php";
    include_once "PHPMailer/SMTP.php";

    if (isset($_POST['submit'])) {
        $subject = $_POST['subject'];
        $email = $_POST['email'];
        $message = $_POST['message'];
        $mail = new PHPMailer();

        //if we want to send via SMTP
        $mail->Host = "smtp.34sp.com";
        //$mail->isSMTP();
        $mail->SMTPAuth = true;
        $mail->Username = "XXXXXXXXXXXXXXX";
        $mail->Password = "XXXXXX";
        $mail->SMTPSecure = "ssl"; //TLS
        $mail->Port = 465; //587

        $mail->addAddress('XXXXXXXXXX');
        $mail->setFrom($email);
        $mail->Subject = $subject;
        $mail->isHTML(true);
        $mail->Body = $message;
        //$mail->addAttachment($file);

        if ($mail->send())
           echo "<h1>Sent Successfully! Thank you"." ".$name.", We will contact you shortly!</h1></br>
      Use the 'back' arrow to go back to the main page...";
        else
            echo "Something went wrong!";

        
    }
?>
 

Theme customization system

You can customize some areas of the forum theme from this menu.

  • Wide/Narrow view

    You can control a structure that you can use to use your theme wide or narrow.

    Grid view forum list

    You can control the layout of the forum list in a grid or ordinary listing style structure.

    Picture grid mode

    You can control the structure where you can open/close images in the grid forum list.

    Close sidebar

    You can get rid of the crowded view in the forum by closing the sidebar.

    Fixed sidebar

    You can make it more useful and easier to access by pinning the sidebar.

    Close radius

    You can use the radius at the corners of the blocks according to your taste by closing/opening it.

  • Choose the color combination that reflects your taste
    Background images
    Color gradient backgrounds
Back