Click to See Complete Forum and Search --> : Provide email address, open page


Duke Will
08-21-2003, 03:45 PM
How could I do this...

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.

...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?

AdamGundry
08-21-2003, 04:08 PM
It's best to do this with a server-side script - I'd recommend PHP, but you could do it in most languages.

Doing it on the client side is less reliable, insecure, and probably requires Javascript to work (not available to 13% of web users).

Adam

pyro
08-21-2003, 04:24 PM
http://www.webdevfaqs.com/php.php#mailer

Duke Will
08-21-2003, 06:16 PM
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.

pyro
08-21-2003, 10:45 PM
You could swap this out

header ("Location:$location");

in favor of

<script type="text/javascript">
window.open("thankyou.htm","thankyou","width=400,height=300");
</script>

For more info on new windows look at http://www.webdevfaqs.com/javascript.php#popup

Duke Will
08-21-2003, 11:20 PM
Thanks for replying but I don't quite follow. You mean put that script code in the mailer.php page? In lieu of...

header ("Location:$location");

Is there a way to do it without javascript?

Originally posted by pyro
You could swap this out

header ("Location:$location");

in favor of

<script type="text/javascript">
window.open("thankyou.htm","thankyou","width=400,height=300");
</script>

For more info on new windows look at http://www.webdevfaqs.com/javascript.php#popup

pyro
08-22-2003, 07:03 AM
I don't believe there is a way to automatically open a new window without using javascript...

Duke Will
08-22-2003, 07:21 AM
So, you mean to literally put that script code in the mailer.php page? In lieu of...

header ("Location:$location");

???

pyro
08-22-2003, 08:17 AM
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:

<form name="yourform" action="mailer.php" method="post" target="_blank">

Duke Will
08-24-2003, 10:00 AM
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...

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...

"If you are interested in POSSIBLY DONATING to Kyle if a donation campaign is created, please provide your email here and send."

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?

Thanks, as always.

pyro
08-24-2003, 10:12 AM
Sure, just add a hidden input field to your forms named subject

<input type="hidden" name="subject" value="Subject of the email you will receive from this form">

and change this in the mailer.php script:

$subject = "Results from your Request Info form"; #set the subject lineto

$subject = $_REQUEST['subject'] #set the subject line

Duke Will
09-01-2003, 07:53 PM
Could you tell me without too much trouble for you, could the script...

1. Also send an email to the person filling the form.
2. Ideally, could I put in there a different message from the one I get as the webmaster. Such as...

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)

Please send your payment to: (para. break)

Donation Fund
Address
City, St, Zip (para. break)

And please refer your friends! Send them here: http://www.wepay.com! (para. break)

Thanks,
GolferBill (DukeWill)

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.

pyro
09-02-2003, 07:15 AM
1: You can send a carbon copy by changing the headers something like this:

$headers = "From: Form Mailer"; #set the from address, or any other headers
$headers.="Cc:their@email.com\n";

2: Not sure what you are asking...

3: Depends... A line break is either \n (*nix) or \r\n (win) or <br> (HTML)

Duke Will
09-02-2003, 08:02 AM
2: Not sure what you are asking...

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.

That is an example of what the email could say.

pyro
09-02-2003, 12:01 PM
I would recommend just using two entirely different mail() (http://us4.php.net/manual/en/ref.mail.php) calls...

Duke Will
09-02-2003, 12:17 PM
Originally posted by pyro
I would recommend just using two entirely different mail() (http://us4.php.net/manual/en/ref.mail.php) calls...

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?

pyro
09-02-2003, 12:28 PM
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.

Duke Will
09-07-2003, 06:23 PM
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."

pyro
09-07-2003, 09:22 PM
Yes, just add the code in, but be sure you add it before the header redirect code...