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 8385701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:44:24+00:00 2026-06-09T17:44:24+00:00

I have an html page with a php form submission, it’s very basic.. what

  • 0

I have an html page with a php form submission, it’s very basic.. what I am looking to do is as of right now it submits, then goes to a blank page with the words “thank you” etc, but what I am looking to do is when the user submits the form, it pop up a window or lightbox that says “thank you for submitting”. How can I achieve this? Here’s the form’s html code, and the actual php code for the submit.

html code:

        <form method="post" action="includes/buy.php">
        <h2> Sizes: </h2><select name="sizes"><option value="1">1</option></select>
        <h2> Email: </h2><input type="text" name="email" />
        <input type="hidden" value="black" name="color" />
        <input  type="image" value="submit" src="images/buynow.jpg" />
        </form>

php form submission code:

<?php
if(isset($_POST['email'])) {

$email_to = " ";
$email_subject = "subject line here";


function died($error) {
echo "We're sorry, but there's errors found with the form you submitted.<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}

if(!isset($_POST['email'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');       
}

$email_from = $_POST['email']; 
$color = $_POST['color'];
$sizes = $_POST['sizes'];


$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email_from)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}

if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form details:\n\n";

function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}

$email_message .= "Email: ".clean_string($email_from)."\n";
$email_message .= "Size: ".clean_string($sizes)."\n";
$email_message .= "Color: ".clean_string($color)."\n";



// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);  
?>

<?php
}
die();
?>
  • 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-06-09T17:44:26+00:00Added an answer on June 9, 2026 at 5:44 pm

    I’d suggest you to use AJAX. Here’s an example:

    HTML:

    <form name="yourForm" action="">
        <input type="text" name="field1" />
        <input type="text" name="field2" />
        <input type="submit" class="formSubmit" />
    </form>
    

    JavaScript (jQuery):

    $('.formSubmit').on('click', function() {
        var field1 = $('input[name=field1]').val();
        var field2 = $('input[name=field2]').val();
        $.ajax({
            type: 'POST';
            url: 'yourPHPScript.php?f1='+ field1 +'&f2='+ field2;
            success: function(result) {
                alert(result);
            }
        });
    });
    

    PHP:

    // proccess the data
    die('successful');
    

    In PHP file: if something’s wrong, just die() that result and it will display an alert().

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

Sidebar

Related Questions

I have am HTML form in a PHP page. The form has various inputs.
I have a simple html form. On php page. A simple list is placed
I have created a html page in php and upon submission i validates that
I have a HTML page with a form. The form submits their address to
So I have a form on PHP/HTML page. User submitss it to that same
Ok, so I have made a form on a .html page and a .php
I have an HTML order form that collects info and then on submission passes
I have a basic AJAX form submission function in the head of my page
I'm having a strange problem. I have a HTML page with PHP code which
I have a html button linked to php page. The php page calls 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.