PHP Form with PayPal

iCtrl

New Member
Looking for a bit of direction to build a PHP form that will be split into 2 parts and ends with a user purchasing a product using PayPal.The first stage asks a series of questions such as name, address, email etc. It will also ask a simple question with a series of radio buttons, if they choose none then the user will be told that someone will be in touch and end there, if they choose one of the other options then they will be taken to stage two.Regardless of the options chosen at this point all info from stage 1 will be sent via email.The second stage basically gets the users PayPal info.thanksUPDATE:I've simplified this considerably, so now there is just one form which will grab the data and send it to an email, and then depending on there choice of radio button either show the message or send them to PayPal.I need help with checking the radio option and showing the message/redirecting to PayPal, and sending the info to an email address. And also sending the info to PayPal.The code is as follows:\[code\]<?php if(isset($_POST['submit'])) { $to = "[email protected]"; $subject = "SolidCAM Xpress"; $name_field = $_POST['name']; $email_field = $_POST['email']; $phone_field = $_POST['message']; $company_field = $_POST['company']; $reseller_field = $_POST['reseller']; $body = "From: $name_field\n E-Mail: $email_field\n Phone:\n $phone_field\n Company:\n $company_field\n Reseller:\n $reseller_field"; mail($to, $subject, $body); } else { ?> <form method="POST" action=""> <fieldset> <legend>Purchase SolidCAM Xpress</legend> <ul> <li><label for="name">Name <input type="text" name="name" /></label></li> <li><label for="email">Email <input type="text" name="email" /></label></li> <li><label for="phone">Phone <input type="text" name="phone" /></label></li> <li><label for="company">Company <input type="text" name="company" /></label></li> </ul> <p>Do you currently have SolidWorks, if yes who is your reseller?</p> <ul> <li><label for=""><input type="radio" name="reseller" value="http://stackoverflow.com/questions/3789411/None" /> Don't have SolidWorks</label></li> <li><label for=""><input type="radio" name="reseller" value="http://stackoverflow.com/questions/3789411/Cad Connect" /> Cad Connect</label></li> <li><label for=""><input type="radio" name="reseller" value="http://stackoverflow.com/questions/3789411/Cadtek" /> Cadtek</label></li> <li><label for=""><input type="radio" name="reseller" value="http://stackoverflow.com/questions/3789411/CCSL" /> CCSL</label></li> <li><label for=""><input type="radio" name="reseller" value="http://stackoverflow.com/questions/3789411/Innova" /> Innova</label></li> <li><label for=""><input type="radio" name="reseller" value="http://stackoverflow.com/questions/3789411/NT CAD/CAM" /> NT CAD/CAM</label></li> <li><label for=""><input type="radio" name="reseller" value="http://stackoverflow.com/questions/3789411/Solid Engineer" /> Solid Engineer</label></li> <li><label for=""><input type="radio" name="reseller" value="http://stackoverflow.com/questions/3789411/Solid Solutions Ireland" /> Solid Solutions Ireland</label></li> <li><label for=""><input type="radio" name="reseller" value="http://stackoverflow.com/questions/3789411/Solid Solutions Management" /> Solid Solutions Management</label></li> <li><label for=""><input type="radio" name="reseller" value="http://stackoverflow.com/questions/3789411/TMS Scotland" /> TMS Scotland</label></li> </ul> <p><input type="submit" name="continue" value="http://stackoverflow.com/questions/3789411/Continue" /></p> </fieldset> </form> <?php } // When user clicks continue send all data to [email protected] // Then check if user has selected None from the last question then show the following and prevent them from proceeding if() { ?> <p>SolidCAM Xpress requires a valid copy of SolidWorks, we will be in touch shortly to discuss pricing!</p> <?php } else { // User has selected something other than None, send them off to PayPal } ?>\[/code\]
 
Back
Top