Add a second action to html form

I have my form mail working just fine, but I want to add another action - send the form data to php file which will save into a mysql database. I’ve looked online for solutions and they seem quite complicated, so before I dive in, I want to check with our DreamHost team to see what they say.
I’ve also searched the Discussion forum and haven’t found any suggestions yet…

You can’t have two actions on a form. By definition, there’s only one action.

If you’re writing a PHP script to handle the input, though, you’re set. Just have the script do both the emailing and the database work.

What would that look like to add the command to the PHP script?
How do you include the in the PHP?

Thanks, Don

There are several ways to do it. The easiest is probably just to slip in and out of PHP.


<?php // [php stuff] ?> <?php // [php stuff] exit; ?> [/php]

what you could do is have the page that has the HTML on it send the required fields to the php file and then have it add it to the DB and have that page post it to the dreamhost mailer.

but in reality what would be much more simpler is to just use PHP to send the email anyway and then you can use $_POST variables to add it to the DB at the same time

Forget about our formmail script. It’s a tool for people who can’t write their own scripts. You are writing your own script, so you can just use the PHP mail() function.

Thanks for all your suggestions, I learned a lot by your ideas. Doing websites is so much more fun when you can interact with others and share different ways of doing things.