davelearning Posted February 4, 2011 Share Posted February 4, 2011 Hi all, What I am trying to achieve is, I thought quite simple! Basically, a user signs up and chooses a package, form is submitted, details added to the database, email sent to customer, then I want to direct them to a paypal payment screen, this is where I am having issues! Is their any way in php to submit a form without user interaction? Here is my code for the form process page <?php include('config.php'); require('scripts/class.phpmailer.php'); $package = $_POST['select1']; $name = $_POST['name']; $email = $_POST['email']; $password = md5($_POST['password']); $domain = $_POST['domain']; $a_username = $_POST['a_username']; $a_password = $_POST['a_password']; $query=mysql_query("INSERT INTO orders (package, name, email, password, domain, a_username, a_password) VALUES ('$package', '$name', '$email', '$password', '$domain', '$a_username', '$a_password')"); if (!$query) { echo "fail<br>"; echo mysql_error(); } else { $id = mysql_insert_id(); $query1=mysql_query("INSERT INTO customers (id, name, email, password) values ('$id', '$name', '$email', '$password')"); if (!$query1) { echo "fail<br>"; echo mysql_error(); } if($package=="Reseller Hosting") { //email stuff here - all works - just cutting it to keep the code short if(!$mail->Send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; } ?> <form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick-subscriptions"> <input type="hidden" name="business" value="[email protected]"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="item_name" value="Jolly Hosting Reseller Packages"> <input type="hidden" name="no_shipping" value="1"> <!--1st month --> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="a3" value="3.00"> <input type="hidden" name="p3" value="1"> <input type="hidden" name="t3" value="M"> <input type="hidden" name="src" value="1"> <input type="hidden" name="sra" value="1"> </form>'; <?php } //last } //end ?> Link to comment https://forums.phpfreaks.com/topic/226705-submit-form-send-email-autosubmit-another-form/ Share on other sites More sharing options...
drisate Posted February 4, 2011 Share Posted February 4, 2011 To redirect to Paypal you can do an URL redirect like this header("location:https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=$paypal&item_name=$name&amount=$amount¤cy_code=CAD¬ify_url=".urlencode($notify_url)."&lc=EN&custom=$LAST&return=".urlencode($return)); Link to comment https://forums.phpfreaks.com/topic/226705-submit-form-send-email-autosubmit-another-form/#findComment-1169950 Share on other sites More sharing options...
davelearning Posted February 4, 2011 Author Share Posted February 4, 2011 Perfect! Thanks Link to comment https://forums.phpfreaks.com/topic/226705-submit-form-send-email-autosubmit-another-form/#findComment-1169965 Share on other sites More sharing options...
drisate Posted February 4, 2011 Share Posted February 4, 2011 Your welcome ;-) Link to comment https://forums.phpfreaks.com/topic/226705-submit-form-send-email-autosubmit-another-form/#findComment-1169966 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.