Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3221390
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:52:14+00:00 2026-05-17T15:52:14+00:00

I am in the process of creating a PHP contact form and all I

  • 0

I am in the process of creating a PHP contact form and all I have is that little problem, with the php script I have, that when the email was send out a new “Thank you” page is called.So the actual site with the contact form disappears BUT I DON`T WANT THAT HAPPEN.

If the send button is hit I want to stay on my site, showing an empty contact form and maybe below the contact form just 1 line, saying “Thank you…..”.

How can I make that happen? Is there any code snippet out there that can explain to me what I have to include to my html and to my php file? Hopefully it will…Below is how my php ends right now.

// send Email 
if (@mail( $empfaenger, htmlspecialchars( $betreff ), $mailbody, $mailheader ))
{
    // if email was successfully send
    echo 'Thank you for your Email. We will get in touch with you very soon.';
}

EDIT
@FreekOne
Currently I am using your code with a slight modification because I wanted to make the thank you and or error panel make slide out and have the text fade in. The script is accepting my code (because it is still working) but actually I can not see that the text actually fades in. I have seen samples of sliding panels with fading in text. So it seems to be a wrong kind of coding that I did.
Please view the code here if you want:
http://jsbin.com/ohuya3
Maybe you can point me to the right direction. Of course, help would be appreciated from all of you guys here around.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T15:52:14+00:00Added an answer on May 17, 2026 at 3:52 pm

    Set the form to send the data to the same page, and have your script listen for a submit. Something like:

    contact.php

    <?php
    // Check if form was previously submitted
    if(isset($_POST['myFormSubmitted'])) {
        // Do your form processing here and set the response
        $response = 'Thank you for your Email. We will get in touch with you very soon.';
    }
    ?>
    <!-- HTML here -->
    <?php
    if (isset($response)) { // If a response was set, print it out
        echo $response;
    }
    ?>
    <form method="POST" action="contact.php">
        <!-- Your inputs go here -->
        <input type="submit" name="myFormSubmitted" value="Submit">
    </form>
    <!-- More HTML here -->
    

    UPDATE

    Considering the provided extra info, I would personally do it with jQuery, through AJAX. First, setup your form and the container for the result:

    HTML

    <form id="myForm" method="POST" action="contact.php">
        <input type="text" id="name" name="name">
        <input type="text" id="email" name="email">
        <input type="text" id="message" name="message">
        <input type="submit" name="myFormSubmitted" value="Submit">
    </form>
    <div id="formResponse" style="display: none;"></div>
    

    Then setup the php script which handles the submitted data and outputs the response.

    PHP (contact.php)

    <?php
    if(isset($_POST['myFormSubmitted'])) {
        // Do your form processing here and set the response
        echo 'Thank you for your Email. We will get in touch with you very soon.';
    }
    ?>
    

    And finally, the jQuery script which will submit your form without leaving the page and insert the result in your result container (with a nice and simple fade in effect).

    jQuery

    $("#myForm").submit(function() {
        $.post('contact.php', {name: $('#name').val(), email: $('#email').val(), message: $('#message').val(), myFormSubmitted: 'yes'}, function(data) {
            $("#formResponse").html(data).fadeIn('100');
            $('#name, #email, #message').val(''); /* Clear the inputs */
        }, 'text');
        return false;
    });
    

    Hope this helps !

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a process using proc_open in one PHP script. How do i
i have this process that is the heart of my app, that im creating,
Suppose that a process is creating a mutex in shared memory and locking it
I'm in the process of creating a double-linked list, and have overloaded the operator=
I'm in the process of creating an app. I'd like to have a pared
I am in the process of creating an input form on a record specific
I am in the process of creating a new team project by executing the
Well, I have a problem (ok, no real problem, but I wanna try out
I'm in the process of creating a PHP site. It uses multiple PHP classes,
I have a caching system build within php that stores the results of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.