View Full Version : Is This Possible Or Not?
mydogisthebest
16th April 2010, 18:28
Hi,
I would like the contents of a user submit form to be sent to me via e-mail from a Contact Us Page or Address Info etc for instance - (simple).
Now here's my problem:
I would then like the page to automatically go to PayPal for the user to pay for services etc, is this at all possible?
Is it simply just a case of redirect user or what :| this would need to be a seamless action or else user may not understand and end up not paying etc.
Any coding would be greatly appreciated.
iKreativ
16th April 2010, 18:39
Yes easily, just set the 'header location' to PayPal so when the form is successfully sent it redirects.
iKreativ
16th April 2010, 18:43
Something like this, change to suit.
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$url = $_POST['url'];
$message = $_POST['message'];
$IP=$_SERVER['REMOTE_ADDR'];
$HOST= gethostbyaddr($IP);
function check_email($email)
{
if(strpos($email, "@"))
{
return true;
}
else
{
return false;
}
}
// Validation
if(3 < strlen($name) && 3 < strlen($email) && 4 < strlen($message) && check_email($email))
{
$email_message = <<< EMAIL
Message from online client.
Name: $name
Email: $email
Website: $url
Message: $message
User IP: $IP
User Host: $HOST
EMAIL;
if(mail('your@email.com','Contact Form', $email_message))
{
header( "Location: http://paypal.com" );
}
else
{
echo "Sorry, there was a problem sending your email. Please use the browser's 'back' button and check the form.";
}
}
else
{
echo "Sorry, there was a problem sending your email. Please use the browser's 'back' button and check the form.";
}
?>
Obviously this is very simple and could be elaborated on.
mydogisthebest
16th April 2010, 18:45
Yes easily, just set the 'header location' to PayPal so when the form is successfully sent it redirects.
But what about if I was just using one form page and not a thank you page?
iKreativ
16th April 2010, 18:51
But what about if I was just using one form page and not a thank you page?
Save that code as say, feedback.php into your web directory and just set your forms action to that file location.
mydogisthebest
16th April 2010, 18:55
iKreativ,
Have you tested this, should be good if it is a seamless action.
iKreativ
16th April 2010, 19:00
Yes, it's running on my site now, just a slightly more elaborate version.
mydogisthebest
16th April 2010, 19:34
Hi,
Does anyone know how to do this in JavaScript?
Thanks.
iKreativ
16th April 2010, 19:36
Do what with Javascript?
mydogisthebest
16th April 2010, 19:41
Do what with Javascript?
Hi, it's just that I have decided to insert the Contact Form in to a JavaScript that I already have on one of my sites, does php sit into a JavaScript, sorry it's been a while, updating my sites.
iKreativ
16th April 2010, 19:45
Hi, it's just that I have decided to insert the Contact Form in to a JavaScript that I already have on one of my sites, does php sit into a JavaScript, sorry it's been a while, updating my sites.
No need for JS, that PHP will work as is.
mydogisthebest
16th April 2010, 20:16
Sorry if I am coming accross as dim, but to be clear now.....
I have an Order Form in JavaScript that a user fills in and clicks submit - I then get the users details and order via email - and in turn the user gets seamlesly directed to Paypal for their payment, is all this possible using the JavaScript and the php combined! :(
iKreativ
16th April 2010, 20:31
Whats your site address?
nimmysnv
17th April 2010, 05:43
Hi,
I would like the contents of a user submit form to be sent to me via e-mail from a Contact Us Page or Address Info etc for instance - (simple).
Now here's my problem:
I would then like the page to automatically go to PayPal for the user to pay for services etc, is this at all possible?
Is it simply just a case of redirect user or what :| this would need to be a seamless action or else user may not understand and end up not paying etc.
Any coding would be greatly appreciated.
Hi,
Yes off course it is possible and you just need to download the plug in for the paypal and the attach it you your page.
Thanks
theofficephone.com