PDA

View Full Version : regarding mail form in html file



nydr
December 26th, 2004, 10:36 AM
I have my mail form code in the .html file with the form itself and in the action of the form i have action="<? echo($PHP_SELF) ?>" so that it uses the php from the file for the script.
But when someone goes to that page it runs through the mail form and sends a mail to the email address. Do I use isset function for things like this? Do I use an if statement with submit i tried that and it didn't work.

RushScripting
December 28th, 2004, 04:52 PM
I am taking it as your php code that actually does the emailing is running instead of the form showing? Well that is what i got from it and yes you could use an isset() to check for a submit.



if( isset($_POST['name of button']) ){

//CODE HERE

}


You would want to change the name of button to the name of the submit button. I hope this help ^_^

aknatn
December 28th, 2004, 11:29 PM
Yes, use isset, but I think you syntax is wrong in the form action, I believe it is:

action="<?=$PHP_SELF?>"

teiz77
December 29th, 2004, 05:16 AM
Yes, use isset, but I think you syntax is wrong in the form action, I believe it is:

action="<?=$PHP_SELF?>"

if you want to doe it the official way it must be:

action="<? echo $_SERVER['PHP_SELF']; ?>"

aknatn
December 29th, 2004, 01:04 PM
@Teiz77 - Hmm... will it work the way he had it?

teiz77
December 29th, 2004, 02:35 PM
@Teiz77 - Hmm... will it work the way he had it?

I think (not exactly sure) your way won't work with php5...

aknatn
December 29th, 2004, 02:46 PM
Interesting, thanks for the side note, I am still using 4.3.7 I use

action="<?=date('blah blah')?>"
for date stamps, will that still work that way?

teiz77
December 30th, 2004, 05:57 AM
yeah that will still work. The predefined constants like $PHP_SELF are changed.