Jump to content

Email then Redirect to PayPal


mroberts46

Recommended Posts

I'm trying to do one of two things (whichever I get to work first): Create a form that both submits the data by email AND redirects user to a different page, OR modify a PayPal Buy Now button to request the additional data and have it emailed to the client. The code below is one of many attempts at creating an email form that redirects to another page containing the PayPal button. Can someone please give me some pointers?


This is before the doctype tag:

<?php
$fName = $_POST['fName'];
$lName = $_POST['lName'];
$email = $_POST['email'];
$cEmail = $_POST['cEmail'];
$phone = $_POST['tele'];
$pickUp = $_POST['pickUp'];
$dropOff = $_POST['dropOff'];
$date = $_POST['date'];
$service = $_POST['service'];
$instruct = $_POST['instruct'];
$human = $_POST['human'];
$thankyou = 'thankyou.htm';

$from = 'From: Joyful Xpressions';
$to = 'feliciaharried@yahoo.com';
$subject = 'Service Request';

$body = "From: $fName $lName\n E-Mail: $email\n Phone: $phone\n \n Pick Up Location: $pickUp\n Drop Off Location: $dropOff\n Pick Up Date: $date\n \n Service Requested: $service\n \n Special Instructions: $instruct";
?>


This is the form:
 

<form action="service.php https://www.paypal.com/cgi-bin/webscr" method="post" name="register" target="_top" onSubmit="document.location='thankyou.htm';">
<h2>Register</h2>
<p>Give us a try! Use this form to sign up for your first FREE pick up. Enter your information below and submit.
You will get a Paypal button which allows you to select the service you want and proceed to Paypal's
secure payment page to process your payment. You may be asked to enter some information again.</p>
<hr/>
<fieldset>
<legend>Personal Information</legend>
<label for="fName">First Name: </label>
<input autocomplete="on" autofocus name="fName" placeholder="First Name" required type="text" />
<br/>
<label for="lName">Last Name: </label>
<input autocomplete="on" name="lName" placeholder="Last Name" required type="text" />
<br/>
<label for="email">Email: </label>
<input autocomplete="on" name="email" placeholder="john.doe@example.com" required type="email" />
<br/>
<label for="cEmail">Confirm Email: </label>
<input autocomplete="off" name="cEmail" placeholder="john.doe@example.com" required type="email" />
<br/>
<label for="tele">Phone: </label>
<input autocomplete="on" name="tele" placeholder="555-555-5555" required type="tel" />
</fieldset>
<br/>
<br/>
<fieldset>
<legend>Service Request</legend>
<label for="pickUp">Complete Address for Pickup: </label>
<textarea cols="20" name="pickUp" placeholder="Please enter your desired pickup location." required rows="3"></textarea>
<br/>
<label for="dropOff">Complete Address for Delivery: </label>
<textarea cols="20" name="dropOff" placeholder="Please enter your desired drop off location." required rows="3"></textarea>
<br/>
<label for="date">Pickup Date: </label>
<input autocomplete="off" min="2013-01-01" name="date" required type="date" />
<br/>
<label for="service">Chore: </label>
<select name="service">
<option value="1 Bag">1 Bag $35.00 USD</option>
<option value="2 Bags">2 Bags $65.00 USD</option>
<option value="Express Service">Express Service $15.00 USD</option>
<option value="King Comforter">King Comforter $20.00 USD</option>
<option value="Queen Comforter">Queen Comforter $15.00 USD</option>
</select>
<br/>
</fieldset>
<br/>
<br/>
<fieldset>
<legend>Special Intructions</legend>
<textarea cols="70" name="instruct" placeholder="Please enter any special instructions you may have regarding your service request here." rows="10"></textarea>
<br/>
</fieldset>
<br/>
<br/>
<fieldset>
<label>*What is 2+2? (Anti-spam)</label>
<input name="human" placeholder="Type Here">
<br/>
<br/>
<input type="hidden" name="return" value="http://expressyourchores.com/thankyou.htm" />
<input id="submit" type="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!" />
</fieldset>
<br/>
<? if ($_POST['submit'] && $human == '4') {
     if (mail ($to, $subject, $body, $from)) {
             echo '<p>Test Failed</p>';
     } else {
         echo '<p>Something went wrong, go back and try again!</p>';
     }
    } else if ($_POST['submit'] && $human != '4') {
     echo '<p>You answered the anti-spam question incorrectly!</p>';
    } ?>
</form>

How can I modify this form to redirect to the PayPal button page?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.