How to use PHP alert box -


i have html page, textbox(required field) , button , php script associated button sending email

whenever put email address , clicks on button sending mail, working fine want whenever give his/her email id , clicks butto alert box come message subscribing us.

how .??

this html

subscribe us</p>           <form id="subscribe" name="subscribe" action="subscribe.php" method="post"  class="validate" target="_blank">             <div class="input-append">               <input type="email" id="email" name="email" placeholder="your email" />               <button class="subscribe-button btn" type="submit" onclick="return     check();">subscribe</button>             </div>           </form> 

and php script

<?php /* subject , email varialbles*/  $emailsbuject = 'subscribe'; $webmaster = 'help@intaxfin.com'; $emailsbuject2 = 'thank you'; $client = ' $emailfeild\r\n'; /*gathering data variables*/  $emailfeild = $_post['email'];  // admin message body $body= <<<eod our new subscriber $emailfeild  email: $emailfeild  eod;  $textmessage = <<<eod      thank subscribing us. possible.  eod;     $headers = "from: $emailfeild\r\n";     $header = "from: $noreply@intaxfin.com";     $success = mail($webmaster,$emailsbuject,$body,$headers);     $success1 = @mail($emailfeild,$emailsbuject2,$textmessage,$header);     /*result*/       $theresults = <<<eod eod;  echo  "$theresults";  header("location: http://www.sample.com/"); exit; ?> 

in simple can put javascript code in php.

replace this:

header("location: http://www.sample.com/"); 

with this:

echo "<script>alert('thanks subscribing!')</script>"; 


please note:

to honest better re-direct user page in order avoid user re-submitting page on refresh. have @ post/redirect/get pattern.

popups can extremely annoying on websites. should create page called "thank-you.html" can re-direct user on successful submission has access site navigation options or re-direct form page after few seconds.


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -