Need some help with a submit button

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rjmxracer1
Forum Newbie
Posts: 6
Joined: Tue Dec 30, 2003 9:09 am

Need some help with a submit button

Post by rjmxracer1 »

Alright, I have a some what of a simple problem that has been bothering me for a while. I have this form made in HTML, at the end of it i have a submit button. I want the submit button to e-mail the answers to a person along with bring the viewer to another web page. Yet with HTML you can only define one action with the submit button. If anyone could give me an idea of what to do, or if there is a better way to do this simple task.
Thanks
RJ
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

In the php script you can first send email (perhaps using [php_man]mail[/php_man] function) then redirect the user to some page using [php_man]header[/php_man]("Location: somepage.php");
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

...

Post by kettle_drum »

By using either POST or GET as the method in the form tag, along with the action being the address of the php script you can easily do it with mail(), and you could then simply include the thank you page, or whatever in the same script that mails the answers - theres no need to redirect - just make the script do both things.
Post Reply