I use html text in a widget in a WordPress sidebar. I created a hypertext mailto: link be sent to a specific email address. A email pop up window gets displayed to compose and send, however once the email is sent I would like to redirect the visitor to a thank you or return to the contact page. Now it get kick out of my website all together.
Can a PHP programmer help with the PHP mailto redirection?
Abdelhadi Touil answers:
Hope these links help you:
I think what you are looking for is the same as mentioned in the above links.
I see your problem. I understand that you use like this coder <strong><a href="mailto:[email protected]?Subject=Hello%20again"></strong> And when you click on this, it will create a custom message form.
I would say that you cannot use this when you want to redirect to a certain page after submission on this form.
My suggestion is:
1.) Create a custom form page. For example you create a page http://yourdomain.com/custompage/ . And this will be you simple custom form code.
#This will process the form
if(isset($_POST)AND $_POST['send'] == 'SENDMAIL'):?>
<?php $sent = mail($_POST['fromemail'],$_POST['subject'],$_POST['message'],$_POST['toemail']);
echo 'MAIL FAILED TO SEND';
<?php endif; ?>
FROM EMAIL: <input type="email" name="fromemail" /><br />
TO EMAIL: <input type="email" name="toemail" /><br />
SUBJECT: <input type="text" name="subject" /><br />
MESSAGE: <input type="text" name="message" /><br />
<input type="hidden" name="redirecturl" value="http://www.yourdomain/redirectpage/" />
<input type="submit" name="send" value="SENDMAIL" />
2.) Instead of using this link <a href="mailto:[email protected]?Subject=Hello%20again"> change it to
Its my pleasure to help you.
It's somewhat what I need, but is it possible to just have the form as a popup for visitors to complete the fields because I have 4 different topic related emails to send to. Unless you tell me I have to created 4 different custompages for each one.
View my contact page here: www.kelownafuturestennis.com/contact, in the iPhone sidebar widget.
So but it's possible with php to send user to thank you page.
As Joseph stated, are you sure you want to use <em> mailto</em>?
This means that only users with a fully configured email client can contact you (but these are the days os webmail clients).
Instead, as you're using wordpress already, you could surely try some css/jquery pop-up contact forms.
<strong>Here's some good examples of what you want to achieve:</strong>
http://www.html-form-guide.com/files/contact-form/simple-popup-form-1/a-page.php (instead of Contact Us button could be each one of you're 4 links).
Yes this is the sort of popup I would like for each of the different email (as you suggest in eg #3). Now how do I implement this?
First of all head to the plugin page and download the zip package.
1) Extract the contents of the zip package and then upload the Contact-Pop folder to your hosting server through FTP (i presume you're having ftp access).
2) Make sure to include the contact-pop.js and contact-pop.css files in your header. The jquery library version 1.8.2 is already called by your theme thus you could skip including this file. The contact form needs jQuery version 1.3.2 but should work with the version included.
3) Open contact-pop.php and head to the config section. Make sure to change the $siteEmail variable with the email you want to receive emails to.
4) Open js/contact-pop.js and make sure the paths to the files in the config section are correct.
You could also follow the steps as described by the plugin author: http://jonraasch.com/blog/contact-pop-jquery-plugin