NameSilo

Php Form

Spaceship Spaceship
Watch

jecn100

Established Member
Impact
0
Hi guys

Just wondering if you know how I would get this to work. I need to send the form booking info to an email address and send payment info to paypal using only one submit button.

Suggestions welcome how I would get round this..........



Here is what I'm trying to send
---------------------------------------------------------------------------
<tr>
<td colspan="2" class="style3"><b>Booking Details - Step 1 of 2</b><br><br></td>
</tr><form method="POST" action="bookinginfo.php">
<tr><td><span class="style3">First name *</span></td><td><input type="text" name="firstname" size="20" maxlength="255" value=""/></td></tr>
<tr><td><span class="style3">Surname *</span></td><td><input type="text" name="lastname" size="20" maxlength="255" value=""/></td></tr>
<tr><td><span class="style3">Address 1 *</span></td><td><input type="text" name="address1" size="40" maxlength="255" value=""/></td></tr>
<tr><td><span class="style3">Address 2</span></td><td><input type="text" name="address2" size="40" maxlength="255" value=""/></td></tr>
<tr><td><span class="style3">Address 3</span></td><td><input type="text" name="address3" size="40" maxlength="255" value=""/></td></tr>
<tr><td><span class="style3">Town *</span></td><td><input type="text" name="town" size="20" maxlength="255" value=""/></td></tr>
<tr><td><span class="style3">County *</span></td><td><input type="text" name="county" size="20" maxlength="40" value=""/></td></tr>
<tr><td><span class="style3">Post code *</span></td><td><input type="text" name="postcode" size="8" maxlength="8" value=""/></td></tr>
<tr><td><span class="style3">Home phone number *</span></td><td><input type="text" name="homephone" size="15" maxlength="15" value=""/></td></tr>
<tr><td><span class="style3">Mobile phone number</span></td><td><input type="text" name="mobile" size="15" maxlength="15" value=""/></td></tr>
<tr><td><span class="style3">Email *</span></td><td><input type="text" name="emailaddress" size="40" maxlength="255" value=""/></td></tr>
<tr><td colspan="2" class="style3" align="center"><br><br><b><A HREF="javascript:popUp('popup.htm')" class="link2">Please make sure you have read our Terms And Conditions before booking</A><br><br><br><br></b></td>
</tr>
<tr>
<td colspan="2" class="style3" align="center"><form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="[email protected]">
<input type="hidden" name="item_name" value="Satellite Navigation Hire + ยฃ100.00 Refundable deposit - www.onenavhire.com">
<input type="hidden" name="amount" value="<?=$cost;?>">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="return" value="http://www.onenavhire.com/b-p.html">
<input type="hidden" name="cancel_return" value="http://www.onenavhire.com/index.html">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="lc" value="GB">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="image" src="images/bookingbutton.gif" border="0" name="submit" alt="">
</form></form><br><br></td></tr>
</table>
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
ok... heres an idea....

You could just have the form post to the bookinginfo.php file.. Then at the end of that page after the email is sent.. add the following code...

PHP:
<?php

$pay = "http://paypal url";
header("location: $pay");
?>

The paypal url can be created by making a link in merchant tools. I believe it is add to emails or such, you have to turn the encryption option off first.

- Ray
 
0
•••
First of all send all the info in that form to that bookinginfo.php file

In that file don't output a single character and do the processing....

The processing would be like assigning the variables from that form input into a string.

A sample string would look like:

PHP:
header("location:https://www.paypal.com/xclick?business=$business_paypal&item_name=$hname$order_id&first_name=$my_sFirstName&last_name=$my_sLastName&email=$my_clientEmail&item_number=1&custom=$hid&amount=$order_total&currency_code=$currency_id&notify_url=$site_url/notify.php&return=$site_url/thankyou.php");


The above variables used in the sample are mostly self explanatory. But still if you have any doubts then ask :D
 
0
•••
First of all in your PHP code, after $cost+=100; add
$cost=round($cost,2);
Or your payment form won't work for values like 156.6777777

Firstly you must have only one form.
So remove:
Code:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">

Now for bookinginfo.php
Create your message to send:
$msg="
First Name: ".$_POST['firstname']."
Last Name: ".$_POST['lastname']."
";
add all fields like this and send email
using:
mail ("[email protected]","Subject", $msg);

finally add:
Code:
$url="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&[email protected]&item_name=".$_POST['itemname']."&amount=".$_POST['amount']."&no_shipping=2&return=http://www.onenavhire.com/b-p.html&cancel_return=http://www.onenavhire.com/index.html&no_note=1&currency_code=GBP&lc=GB&bn=PP-BuyNowBF";
header("location: $url");
exit();

And you're done
 
Last edited:
0
•••
Dynadot โ€” .com Registration $8.99Dynadot โ€” .com Registration $8.99
Unstoppable Domains
Domain Recover
DomainEasy โ€” Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back