Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Double action in form - one for DB and one for email

Status
Not open for further replies.

sbayter

IS-IT--Management
Nov 14, 2002
95
CO
Hi,
I have a form that when submitted saves the values into the db. I need add another action to email me that somebody has fill it out. I'm using a script I have in the CGI-BIN.
I tried using the mail() function but I can't cahnge the php.ini of the server.
Any suggestions?
Thanks,

sbayter
 
any other suggestions?

sbayter
 
A single HTML form can only have one action attribute - it will send the form data there.

What I suggest is:
Set the action to a PHP script that calls your CGI program. Make sure no user input that might be malicious can be passed. Or for the sake of PHP: write the database insertion in PHP.

Then secondly, upon successful data insertion, call the mail() function or the class I mentioned in the previous mail.

As for the more than one action in an HTML form, sorry, to my knowledge no such thing.
 
The data insertion is in PHP. What is not in php is the CGI program that sends the email.
With the class you mentioned before, is there any server configuration that needs to be done?

sbayter
 
No. You need not change anything in the php.ini
In fact, you could use a foreign SMTP host if you have no access to the local sendmail. However, using the local mail program on a UNIX type host should be allowed.

You can trigger the CGI from inside your script - which is not ideal, but possible. If the CGI is able to send mail, PHP can also send mail. Use the class and set the path to sendmail.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top