[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 10-23-2006, 02:41 PM   #1 (permalink)
NamePros Member
 
Join Date: Mar 2004
Posts: 39
50.00 NP$ (Donate)

jecn100 is an unknown quantity at this point


Php Form

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="javascriptopUp('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="payments@onenavhire.com">
<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>
jecn100 is offline  
Old 10-23-2006, 04:26 PM   #2 (permalink)
An American Soldier
 
-Ray-'s Avatar
 
Join Date: Jun 2005
Location: Pennsylvania
Posts: 1,630
2.53 NP$ (Donate)

-Ray- is a splendid one to behold-Ray- is a splendid one to behold-Ray- is a splendid one to behold-Ray- is a splendid one to behold-Ray- is a splendid one to behold-Ray- is a splendid one to behold-Ray- is a splendid one to behold-Ray- is a splendid one to behold


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 Code:
<?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
__________________
Completely Free cPanel Hosting
-- Deployed to Afghanistan --
"There is no such thing as rich over-night unless you owned Google stock in 2006"
-Ray- is offline  
Old 10-23-2006, 11:44 PM   #3 (permalink)
I'll do it

Technical Services

 
-Nick-'s Avatar
 
Join Date: Dec 2005
Location: India
Posts: 6,434
5,169.80 NP$ (Donate)

-Nick- has a reputation beyond repute-Nick- has a reputation beyond repute-Nick- has a reputation beyond repute-Nick- has a reputation beyond repute-Nick- has a reputation beyond repute-Nick- has a reputation beyond repute-Nick- has a reputation beyond repute-Nick- has a reputation beyond repute-Nick- has a reputation beyond repute-Nick- has a reputation beyond repute-Nick- has a reputation beyond repute

Adoption
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 Code:
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
-Nick- is online now  
Old 10-23-2006, 11:59 PM   #4 (permalink)
NamePros Member
 
sote's Avatar
 
Join Date: Jul 2006
Posts: 70
13.20 NP$ (Donate)

sote will become famous soon enoughsote will become famous soon enough


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 ("recepient@email.com","Subject", $msg);

finally add:
Code:
$url="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=payments@onenavhire.com&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 by sote; 10-24-2006 at 01:44 AM.
sote is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 02:45 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85