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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:24:08+00:00 2026-05-26T19:24:08+00:00

I have a form that customers fill in with personal data and also makes

  • 0

I have a form that customers fill in with personal data and also makes choices regarding the service. So with the $_GET function I retrieve the information of that form, do some basic math and show all the information so the customer can preview the order and then hit “SEND” to confirm the job.

I need to send that Preview Order to me by mail but I don’t know how to send all that. I know how to retrieve data from a form and then send it, but have no idea how to send those variables.

FORM

// I am omitting elements to make this shorter    
<select name="Amount">
      <option value="1">1</option>
      <option value="2">2</option>
      <option value="3">3</option>
     </select>

PREVIEW ORDER

  $price = 5;  

    // I am omitting elements to make this shorter 
    // here I do some math     
    $Amount = $_GET['Amount']; 
        // check value and select appropriate item 
        if ($Amount== "1") { 
            $extra = "1"; 
            } 
        elseif ($Amount == "2") { 
            $extra = "2"; 
            } 
        elseif ($Amount == "3") { 
            $extra = "3";


// here is the order preview and this is what I need to email to myself
// the customer should look this preview and then HIT a confirm buttom to get this sent

<?php echo $Name;?><br>
<?php echo $Address;?><br>
<?php echo $E-mail;?><br>
<?php echo $Phone;?><br>
Your order: <?php echo $extra . " " . "products, for a total of" . " " . ($price * $extra); ?>

——————– FINAL VERSION ————— THANKS to all of you guys!

I’ll be only using 2 fields in order to shrink the code

// FORM — The user entries his data

<form method="get" id="order" action="order-info.php">
<h1>Personal Info</h1>
<p>name: <input name="name" type="text" /></p>
<p>email: <input name="surname" type="text" /></p>
<INPUT TYPE = "Submit" Name = "Submit1" VALUE = "Continue">
</form>

//ORDER Preview — Here the user can preview all of his data and product related choices before confirming the order

<?php session_start(); ?>
<?php
// get info personal
$Name = $_GET['name'];
$Email = $_GET['email'];
?>
// Now I echo the info
<h2><?php echo $Name . " " . $Email ; ?><br></h2>
<?php
  // here's where the magic is done thanks to Sheldon Ferns!
  $_SESSION['customerInfo']['name'] = $Name;
  $_SESSION['customerInfo']['email'] = $Email;

?>
// having stored all the info in a session I proceed to send it to the email function. That weird name is because I read you should avoid naming your email process file with predictable names like mail.php, this increases protection against spammers. 
<form  method ="POST" action = "xljkadf.php">
<INPUT TYPE = "Submit" Name = "Submit1" VALUE = "Confirm Order">

//MAIL PROCESS —

<?php  session_start();
 # Anti-header-injection - Use before mail() 
# By Victor Benincasa <vbenincasa(AT)gmail.com> 
foreach($_REQUEST as $fields => $value) if(eregi("TO:", $value) || eregi("CC:", $value) || eregi("CCO:", $value) || eregi("Content-Type", $value)) exit("ERROR: Code injection attempt denied! Please don't use the following sequences in your message: 'TO:', 'CC:', 'CCO:' or 'Content-Type'."); 

  $headers = 'From: Your Site <noreply@yoursite.com>' . "\n".
// in the next line what I do is to send a BCC to me as I want the customer to get a copy of the order without knowing my address  
$headers .= 'Bcc: Your site <yourmail@xxxx.com>' . "\r\n";



  $mailBody = "Order details: \n". 
                "Name: ".$_SESSION['customerInfo']['name'] . "\n".
                "Email: " .$_SESSION['customerInfo']['email'] . "\n";




// Next the mail function. The first arguments is the customer e-mail so he gets a copy of his order.
   mail($_SESSION['customerInfo']['Email'], "Order Info ", $mailBody, $headers);

   ?>
 // A redirect to a thank you page once the e-mail is sent.
<script language="JavaScript" type="text/JavaScript">
<!--
window.location.href = "http://www.yoursite.com/thank-you.html";
//-->
</script>
  • 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-26T19:24:08+00:00Added an answer on May 26, 2026 at 7:24 pm

    You want to sent an email when the user clicks the SEND button from the preview page. But you do not know how to get the data in PHP that the customer is previewing; because Send does not submit a form.
    It this is what your problem is then, here’s what you can do

    When customer submits your, in the previewOrder php file you can save the information in a session variable.. eg

    <?php
      session_start(); ?>
      //The php code you have already written.
    
      //Saving data in session
      <?php
      $_SESSION['customerInfo']['Name'] = $Name;
      $_SESSION['customerInfo']['Address'] = $Address;
      $_SESSION['customerInfo']['Email'] = $Email;
      $_SESSION['customerInfo']['Phone'] = $Phone;
      $_SESSION['customerInfo']['Extra'] = $Extra;
    ?>
    

    Note that session_start() has to be at the beginning of the file.

    Now, from the preview page when the user clicks SEND button, you have to direct the page to a file like sendOrder.php which should like something like this

    <?php
      session_start();
      $mailBody = "Order Info: \n". 
                  "Name: ".$_SESSION['customerInfo']['Name'] . "\n".
                  "Address: " .$_SESSION['customerInfo']['Address'] . "\n".
                  "Email: " .$_SESSION['customerInfo']['Email'] . "\n".
                  "Phone: " .$_SESSION['customerInfo']['Email'] . "\n".
                  "Price: " .$_SESSION['customerInfo']['Price'] . "\n".
                  "Extra: " .$_SESSION['customerInfo']['Extra'] . "\n";
    
       mail('your@mail.com', 'Order Information', $mailBody);
    
    ?>
    

    What you are doing here is reading values you have saved in the session in the preview. SESSIONS is one way you can make variables available across pages.

    Hope this helps,

    PS.I have not tested the code for syntax errors.Please correct them if any 🙂

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

Sidebar

Related Questions

I have a form that is being filled by customers, the form is very
I have this problem, in a form I have a list of customers that
I have an application that uses itextsharp to fill PDF form fields. I got
I have two forms that are called Customers and CustomerControlList In Customers Form, I
I have inherited a project, that provides an order form to a customer. The
I currently have form that checks if a user has unsubmitted changes when they
I have a form that looks kind of like this: <div> <div class=contact> <h1>Person's
We have a form that hosts the WebBrowser control. That is the only control
I have a form that can open a sub form (with ShowDialog ). I
I have a form that and after the user fills in this form, I

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.