Forum Moderators: coopster

Message Too Old, No Replies

Form to email AND database

         

voices

5:29 pm on Aug 1, 2005 (gmt 0)

10+ Year Member



The server I am on requires using cgiemail to send form data. I want to also send this data to a mysql database using php. Is this possible? How?

dmorison

6:36 pm on Aug 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's certainly possible.

Your best bet is probably to do away with cgiemail and investigate using a PHP form to email script. You will find plenty of examples and tutorials on the net and right here on WebmasterWorld [webmasterworld.com]

Then, once you have a PHP form to email solution working you can take the script further and also have it put the information into a database for you.

Basically, you want to learn to do them both separately in PHP, then combine what you've learnt into one script.

/adds: are you implying in your question that your host has specifically stated that only their cgiemail script may be used and that PHP has the mail functions (and presuamably the other ways of sending email) disabled?

voices

7:25 pm on Aug 1, 2005 (gmt 0)

10+ Year Member



That is the problem, due to security reasons we are no longer allowed to use phpmail or formmail. We must use cgiemail.

jd01

1:08 am on Aug 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you cannot edit the cgiemail file to do what you want, you might consider hosting the php formmail file off site - If it is important to you, the $6 a month would be well worth it.

One of the sites I manage does not allow formmail use, so I created the form and host it on an account that does. Then when someone submits the form, I post the information to the externally hosted php mail script and return them to the site they came from - It's about seemless.

You can also insert the data into the DB then call the CGIemail to send the information. Might take a little longer for the form to process, but should still accomplish the goal.

Hope this helps.

Justin

Edited: clarity