NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Php Form

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

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 10-23-2006, 03:41 PM THREAD STARTER               #1 (permalink)
NamePros Member
Join Date: Mar 2004
Posts: 39
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>
????: NamePros.com http://www.namepros.com/programming/250196-php-form.html
????: NamePros.com http://www.namepros.com/showthread.php?t=250196
<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, 05:26 PM   #2 (permalink)
Senior Member
 
-Ray-'s Avatar
Join Date: Jun 2005
Location: Pennsylvania
Posts: 1,839
-Ray- has much to be proud of-Ray- has much to be proud of-Ray- has much to be proud of-Ray- has much to be proud of-Ray- has much to be proud of-Ray- has much to be proud of-Ray- has much to be proud of-Ray- has much to be proud of-Ray- has much to be proud of
 



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.
????: NamePros.com http://www.namepros.com/showthread.php?t=250196

- Ray
__________________
Poker News, articles, discussion
LIKE THIS

Its an iPod, a phone, and an internet communications device.
-Ray- is offline  
Old 10-24-2006, 12:44 AM   #3 (permalink)
I'll do it
 
-Nick-'s Avatar
Join Date: Dec 2005
Location: India
Posts: 6,927
-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness
 


Member of the Month
September 2007
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 offline  
Old 10-24-2006, 12:59 AM   #4 (permalink)
NamePros Member
Join Date: Jul 2006
Posts: 94
sote is a jewel in the roughsote is a jewel in the roughsote is a jewel in the rough
 



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
????: NamePros.com http://www.namepros.com/showthread.php?t=250196
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 02:44 AM.
sote is offline  
Closed Thread


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


Liquid Web Smart Servers  
All times are GMT -7. The time now is 05:34 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger