How to solve php REDIRECTION ISSUE -


<?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@example.com";     $success = mail($webmaster,$emailsbuject,$body,$headers);     $success1 = @mail($emailfeild,$emailsbuject2,$textmessage,$header);     /*result*/       $theresults = <<<eod eod;  echo  "$theresults";  header("location: http://www.example.com/"); exit; ?> 

i have lots of html pages under every page. have text box , button php script associated it.

my problem whenever put email id , clicks button redirect me home page www.example.com. want stay exact page.

if show form in each page add form hidden input , store in input current url

<input type="hidden" name="redirect" value="<?php echo($_server["request_uri"]); ?>" /> 

in script check param , make redirect url

if (isset($_post["redirect"]) && $_post["redirect"] != "") {   $redirect_to = $_post["redirect"]; } else {   $redirect_to = "/"; } header("location:" . $redirect_to); 

Comments

Popular posts from this blog

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

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

delphi - Indy UDP Read Contents of Adata -