Provide email address, open page

windows

Guest
How could I do this...<br />
<br />
For your free report, please provide your email address below, which will subscribe you to my free newsletter, which is sent occasionally on an irregular basis. Upon providing your email address, your report is made available to you.<br />
<br />
...and then what it will do when they hit SUBMIT is send me the email address and then redirect to a web page. I guess they could give me a fake email address but maybe the percentage wouldn't be that high. Any help with code to do that?<!--content-->It's best to do this with a server-side script - I'd recommend PHP, but you could do it in most languages.<br />
<br />
Doing it on the client side is less reliable, insecure, and probably requires Javascript to work (not available to 13% of web users).<br />
<br />
Adam<!--content-->http://www.webdevfaqs.com/php.php#mailer<!--content-->Thanks a lot, I got it to work. WHen it redirects to the thanks.htm page or whatever page, could I make it open a new window with the new page? I don't want them to lose the place where they were when they filled in the info. But I want them to see the new page, obviously because that's why they are providing their info.<!--content-->You could swap this out<br />
<br />
header ("Location:$location");<br />
<br />
in favor of<br />
<br />
<script type="text/javascript"><br />
window.open("thankyou.htm","thankyou","width=400,height=300");<br />
</script><br />
<br />
For more info on new windows look at <!-- m --><a class="postlink" href="http://www.webdevfaqs.com/javascript.php#popup">http://www.webdevfaqs.com/javascript.php#popup</a><!-- m --><!--content-->Thanks for replying but I don't quite follow. You mean put that script code in the mailer.php page? In lieu of...<br />
<br />
header ("Location:$location");<br />
<br />
Is there a way to do it without javascript?<br />
<br />
Originally posted by pyro <br />
You could swap this out<br />
<br />
header ("Location:$location");<br />
<br />
in favor of<br />
<br />
<script type="text/javascript"><br />
window.open("thankyou.htm","thankyou","width=400,height=300");<br />
</script><br />
<br />
For more info on new windows look at <!-- m --><a class="postlink" href="http://www.webdevfaqs.com/javascript.php#popup">http://www.webdevfaqs.com/javascript.php#popup</a><!-- m --><!--content-->I don't believe there is a way to automatically open a new window without using javascript...<!--content-->So, you mean to literally put that script code in the mailer.php page? In lieu of... <br />
<br />
header ("Location:$location"); <br />
<br />
???<!--content-->You know what I just thought of? You should be able to do something like this, and forget about changing the mailer.php script or using javascript:<br />
<br />
<form name="yourform" action="mailer.php" method="post" target="_blank"><!--content-->Pyro, it seems to be working great on my "hireme.html" page. But now, I need to do it again. Now, I am going to build a simple page for...<br />
<br />
I am considering starting a donation drive for a handicapped child. To buy him a computer. So, I was thinking of building a simple page and say...<br />
<br />
"If you are interested in POSSIBLY DONATING to Kyle if a donation campaign is created, please provide your email here and send."<br />
<br />
But *I* need to be able to differentiate between the emails I receive. Some coming in would be for "hireme.html" and some coudl be for "kyle.html." Can I do this with your script? Change the subject or something? Or diff email address, I guess. But can I do it with one mailer.php on my server?<br />
<br />
Thanks, as always.<!--content-->Sure, just add a hidden input field to your forms named subject<br />
<br />
<input type="hidden" name="subject" value="Subject of the email you will receive from this form"><br />
<br />
and change this in the mailer.php script:<br />
<br />
$subject = "Results from your Request Info form"; #set the subject lineto<br />
<br />
$subject = $_REQUEST['subject'] #set the subject line<!--content-->Could you tell me without too much trouble for you, could the script...<br />
<br />
1. Also send an email to the person filling the form.<br />
2. Ideally, could I put in there a different message from the one I get as the webmaster. Such as...<br />
<br />
Thank you so much for your donation. You are very kind to help this child. I will keep no money. Not a penny. (paragraph break)<br />
<br />
Please send your payment to: (para. break)<br />
<br />
Donation Fund<br />
Address<br />
City, St, Zip (para. break)<br />
<br />
And please refer your friends! Send them here: <!-- m --><a class="postlink" href="http://www.wepay.com">http://www.wepay.com</a><!-- m -->! (para. break)<br />
<br />
Thanks,<br />
GolferBill (DukeWill)<br />
<br />
P.S. If not, I guess I could modify the message in the mailer.php as it is now. *IF* I could send a CC to the sender. I'd also have to know how to put a line break or paragraph break in the php code. Thanks for any help.<!--content-->1: You can send a carbon copy by changing the headers something like this:<br />
<br />
$headers = "From: Form Mailer"; #set the from address, or any other headers<br />
$headers.="Cc:[email protected]\n"; <br />
<br />
2: Not sure what you are asking...<br />
<br />
3: Depends... A line break is either \n (*nix) or \r\n (win) or <br> (HTML)<!--content-->2: Not sure what you are asking... <br />
<br />
I get an email with the details of the form. If I want the customer to receive an email with a DIFFERENT body. Body copy as I put in that post, all the way below the comment #2 you said you don't understand down to the P.S.<br />
<br />
That is an example of what the email could say.<!--content-->I would recommend just using two entirely different mail() (<!-- m --><a class="postlink" href="http://us4.php.net/manual/en/ref.mail.php">http://us4.php.net/manual/en/ref.mail.php</a><!-- m -->) calls...<!--content-->Originally posted by pyro <br />
I would recommend just using two entirely different mail() (<!-- m --><a class="postlink" href="http://us4.php.net/manual/en/ref.mail.php">http://us4.php.net/manual/en/ref.mail.php</a><!-- m -->) calls... <br />
<br />
Since I am not a programmer, I'm not sure about all that's on there but I'll dig into it. But basically, when they click the SUBMIT button, could I just have it do two things instead of one? Is that what you are saying? Could I just modify your mailer.php for the second email idea and name it mailer2.php or whatever? And when they click SUBMIT, it executes both? If so, how do I make it do that when they click SUBMIT?<!--content-->I would use the same script, but have it do two different things. First of all, have the script execute as is, then add the stuff you need to send the customer the different information.<!--content-->To have it do the first thing, then the second in the one script, do I just dupe the (modified) code (for the second operation) to the bottom of the script or do I have to modify the script all throughout the script in the various places that it is doing "stuff."<!--content-->Yes, just add the code in, but be sure you add it before the header redirect code...<!--content-->
 
Back
Top