• We are available for any Development work:
  • Email us at: programmer_heart@yahoo.com

PHP header() Not working in jquery mobile site – Solution

I suspect you are trying to send the header after loading any html, which will not work. The php header must occur before any output, including html, JQuery Mobile, etc.

If this is not worked then  you can try second option, which is causing problems using the <form> tag. After browsing through the jQuery Mobile documentation I found this page: http://jquerymobile.com/test/docs/forms/forms-sample.html

The trick here is if you’re doing a form, to force it to not use AJAX. You do this by adding

data-ajax=”false” to the FORM tag.

try to add data-ajax=”false”  in form attribute when you call that page, before redirecting using php header().

Something like this

<pre><code><section id="login">
            <h2>Member Login</h2>
            <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" data-ajax="false">
                <input id="username" type="text" name="username" placeholder="username" />
                <input id="password" type="password" name="password" placeholder="password" />

                <p>Not yet signed up? <a href="register.php" >Register</a></p>

                <input type="submit" name="btnLogin" data-theme="b" value="Sign in">
            </form>
        </section></code></pre>

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Current day month ye@r *

Press Enter to Search