Jump to content

Submit form -> send email -> autosubmit another form


davelearning

Recommended Posts

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="subscription@jollyhosting.com">
<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
Share on other sites

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&currency_code=CAD&notify_url=".urlencode($notify_url)."&lc=EN&custom=$LAST&return=".urlencode($return));

 

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.