| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Member Join Date: Mar 2004
Posts: 39
![]() | 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="javascript opUp('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> |
| |
| | #2 (permalink) |
| Senior Member Join Date: Jun 2005 Location: Pennsylvania
Posts: 1,839
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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: ????: 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. |
| |
| | #3 (permalink) |
| I'll do it ![]() Join Date: Dec 2005 Location: India
Posts: 6,927
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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: The above variables used in the sample are mostly self explanatory. But still if you have any doubts then ask
__________________ |
| |
| | #4 (permalink) |
| NamePros Member Join Date: Jul 2006
Posts: 94
![]() ![]() ![]() | 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"> ????: 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¤cy_code=GBP&lc=GB&bn=PP-BuyNowBF";
header("location: $url");
exit();
Last edited by sote; 10-24-2006 at 02:44 AM.
|
| |