Forum Moderators: coopster
I am running a script which sends an email first then shows an html form. But here what happens, it is taking so long to load the html form because of the mail function. Once mail function executes, the form loads.
I want to run the mail function behind the scene and show the form first. I have tried with the php flush() also. Can anyone please help me regarding this.
I want to show the form first instead of waiting for the mail function to finish execute.
Thanks
Besides that I suppose the script might be modified to run the mail function after you process the form. Of course, I haven't seen the script so I can only speculate about how easy that may be.
//My form comes here..
<form method=post action=''>
some hidden fields..
<input type=text name='name'>
<input type=age name='age'><br>
<input type=submit>
</form>
<?
$message = "Visitor has come to the form";
//My mail function comes here
mail( "", $subject, $message, "From: FrmName <FrmEmail>") ;
THis is a very simple mail function..What could be wrong in this? When I comment the mail function, the form loads faster..
Thanks
Yes, I'd use flush() - first show the output you want, flush(), then mail(), then give any extra output (success /failure).