using meta http-equiv in php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • runway27
    Banned
    New Member
    • Sep 2007
    • 54

    using meta http-equiv in php

    i have a registration page which is a self submitting form <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="POST"

    id="test2" name="registrat ionform">

    where in a user fill a form, after the data has been inserted to a database i would like to redirect the user to a different

    page. i am not able to use header(Location : filename.html) as i have echo statements before and i get a message that headers

    have already been sent. so due to this i am using

    echo (" <meta http-equiv='refresh' content='0;url= thankyou.php?fi rstname=$firstn ame'> "); this works perfectly fine.

    however if a user disables meta refresh which is a very small possibility the above meta tag would not execute to avoid such

    a situation i would like to use echo statements to create a new page which would have html tags and display a similar page to

    thankyou.php


    in my case the php code is placed in the middle of the page which displays messages that a user did not enter in the form.


    the page is so structured that there is some information written using html tags followed by the registration questions where

    the php code is present to validate. i have used

    echo (" <meta http-equiv='refresh' content='0;url= thankyou.php?fn ame=$fname'> ");
    redirectingthep age();
    exit;

    i have used the above code so that even if the echo (" <meta http-equiv='refresh' content='0;url= thankyou.php?fn ame=$fname'>

    "); is not executed the redirectingthep age() function will be executed.


    my question is due to the structure of the page whatever text is present before the form that text is appearing again

    followed by the text i have inside redirectingthep age() function, i do not want this to happen. i would like what is written

    in redirectingthep age() function only to appear. i have defined redirectingthep age() function in a separate file and i am

    calling the file which has redirectingthep age() function by using include statement in the registration page.

    please advice how i can display what is defined in redirectingthep age() function ONLY if the refresh is disabled by the user

    thanks.
  • TheServant
    Recognized Expert Top Contributor
    • Feb 2008
    • 1168

    #2
    I am guessing if someone has disabled meta-refresh they did it for a reason, so you want to honour their wishes. How about firstly displaying "meta-refresh must be enabled to register" or something. Secondly, you can echo a line if the form has been submitted: "If your browser does not refresh, <a href...>click here</a>."

    I guess what I am saying is you don't want to bypass someone's settings, neither do you want to force them to enable something that they want disabled. You need to give them some options.

    Comment

    • Markus
      Recognized Expert Expert
      • Jun 2007
      • 6092

      #3
      TheServant is right, and that's exactly how i would do it.

      Comment

      Working...