Send form data to email and send total amount to paypal

Hi all,

OK let me explain it a bit better, what i have is a form on previous page that sends the data to a complete page, on this page another form appears for a few other details and then a complete button.

What happens on click of complete is all the data is collected and emailed to my client, but what I need to do is open up a paypal payment screen which needs to know the total amount which will be sent to it via the $_SESSION[‘totalHidden’].

The code so far is below:


<?php
session_start(); 
if (isset($_POST['submitFirst'])) {
$_SESSION['size'] = $_POST['Size'];
$_SESSION['text1'] = $_POST['text1'];
$_SESSION['text2'] = $_POST['text2'];
$_SESSION['text3'] = $_POST['text3'];
$_SESSION['case'] = $_POST['Case'];
$_SESSION['colour'] = $_POST['Colour'];
$_SESSION['font'] = $_POST['FontType'];
$_SESSION['border'] = $_POST['Border'];
$_SESSION['totalHidden'] = $_POST['Total'];
}
if (isset($_POST['submit'])) {
$fname = $_POST['FName'];
$sname = $_POST['SName'];
$email = $_POST['Email'];
$telephone = $_POST['Telephone'];
$from = 'From: ' . $name . ' <' . $email . '>';
$to = "[EMAIL="info@accend4web.co.uk"]info@accend4web.co.uk[/EMAIL]"; 
 
$subject = "Slate Sign Build Enquiry";
$content = "Hi Adam, \
\
" . $fname . " " . $sname . ", has built a sign their selections are below: \
\
Size of slate: " . $_SESSION['size'] . "\
\
First line of text: " . $_SESSION['text1'] . "\
\
Second line of text: " . $_SESSION['text2'] . "\
\
Third line of text: " . $_SESSION['text3'] . "\
\
Stylised font: " . $_SESSION['case'] . "\
\
Colour of font: " . $_SESSION['colour'] . "\
\
Font type: " . $_SESSION['font'] . "\
\
Border: " . $_SESSION['border'] . "\
\
Total cost: " . $_SESSION['totalHidden'] . " <br/><br/> Email address: " . $email . "\
\
Telephone number: " . $telephone . " <br/><br/>";
 
$success = "<h3 style='font-size:14px; margin-left:90px; margin-bottom:20px; margin-top:20px;'>Thank you! Your message has been sent!</h3>";
mail($to,$subject,$content,$from);
 
}
?>

<form action="complete.php" method="post">
<label><span style="color:#333;">*</span> First Name:</label>
<input type="text" name="FName" value="<?php if ($_POST['name'] && empty($success)) { echo $_POST['name']; } ?>" />
<label><span style="color:#333;">*</span> Surname:</label>
<input type="text" name="SName" value="<?php if ($_POST['sname'] && empty($success)) { echo $_POST['sname']; } ?>" />
  
<label><span style="color:#333;">*</span> Email:</label>
<input type="text" name="Email" value="<?php if ($_POST['email'] && empty($success)) { echo $_POST['email']; } ?>" />
<label><span style="color:#333;">*</span> Tel:</label>
 <input type="text" name="Telephone" value="<?php if ($_POST['phone'] && empty($success)) { echo $_POST['phone']; } ?>" />
        
<label><span style="color:#333;">*</span> Comments:</label><br />
<textarea name="message" rows="20" cols="20"><?php if ($_POST['message'] && empty($success)) { echo $_POST['message']; } ?></textarea>
        
<input type="submit" class="submit" name="submit" value="Complete" style="position:relative; float:left; left:300px;" />
        
</form>



So basically an email goes to my client with all the data he needs to build the product, and also the person is taken to paypal to pay for their item.

if the only option to connect to paypal is via a paypal button inside a form, maybe the best thing to do is to submit that form, then on success maybe it triggers lightbox or something like it where a paypal button appears.

not sure as I dont think lightbox is the right application for this method its it?

To be activated on success and then allow for html to appear, for the user to click the paypal buttton.

I will also need to pass some session variables to it.