user984187
user984187

Reputation:

jquery mobile posting form content but wont print

I have a strange problem with my code. i'm trying to create a form for users to edit their profile information. It's a simple form like the source further below.

I work with templates and every page will enter the index.php and the page will be build.

Problem is this: I've placed a print_r inside the index to print the _POST to see if anything is posted. but when I submit the the form nothing is posted. when i place the print_r inside the template the print_r suddenly appears as if nothing is wrong and the form was posted. :S

I tried setting the action to different pages but it has no effect.

Also i have a login form and that form for some reason works fine. but when i place it inside the edit_profile template it stops working.

here is the sourcecode for the edit_profile page.

<!DOCTYPE html>
<html>

    <head>

        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <title>edit profile</title>

        <link rel="stylesheet" href="/style/jquery.mobile-1.0.1.css">
        <link rel="stylesheet" href="/style/main.css">

        <script src="/js/jquery-1.7.1.js"></script>
        <script src="/js/jquery.mobile-1.0.1.min.js"></script>
        <script src="/js/global.js"></script>

    </head>

    <body>

       <section data-role="page" id="edit_profile">

            <header data-role="header" id="header" data-position="fixed">
                <h1>edit profile</h1>

                <nav id="main_navigation" data-role="navbar">
                    <ul>
                        <li><a href="/"  >Home</a></li>
                        <li><a href="/news.html"  >News</a></li>
                        <li><a href="/about.html"  >about</a></li>
                        <li><a href="/contact.html"  >Contact</a></li>
                    </ul>
                </nav>

            </header>

            <div data-role="content">

               <h2>edit profile</h2>

               <form action="/account/edit_profile.html" method="post" >
                   <input type="hidden" name="edit" value="edit" />
                   <label for="username">Username:</label>
                   <input type="text" name="username" id="username" value="some username"/>

                   <label for="password">Password:</label>
                   <input type="password" name="password" id="password"/>

                   <label for="email">E-mail:</label>
                   <input type="email" name="email" id="email" value="[email protected]"/>

                   <label for="firstname">Firstname:</label>
                   <input type="text" name="firstname" id="firstname" value="some firstname"/>

                   <label for="lastname">Lastname:</label>
                   <input type="text" name="lastname" id="lastname" value="some lastname"/>

                   <label for="city">City:</label>
                   <input type="text" name="city" id="city" value="some city"/>

                   <label for="adres">Adress:</label>
                   <input type="text" name="adres" id="adres" value="some adres"/>

                   <label for="zip">Zip:</label>
                   <input type="text" name="zip" id="zip" value="some zip"/>

                   <div data-role="controlgroup" data-type="horizontal">
                       <a href="/account.html" data-role="button" data-icon="back">Back</a>
                       <button type="submit" data-icon="check">Save</button>
                   </div>

               </form>

             </div>

       <footer data-role="footer" data-position="fixed">

           <div data-role="controlgroup" data-type="horizontal">
               <a href="/" data-role="button" data-icon="home">Home</a>
               <a href="/account.html" data-role="button" data-icon="grid">Account</a>
               <a href="/logout.html" data-role="button" data-icon="gear" >Logout</a>
           </div>

        </footer>

    </section>


   </body>
   </html>

Hope you guys can help me. If any questions, let me know.

Upvotes: 1

Views: 594

Answers (1)

Malovich
Malovich

Reputation: 971

Your HTML looks decent and it should be jQM-ready. I've worked a bit with jQM/php/MySQL, so I am aware of some of its quirks.

I recommend avoiding the problem for now by writing your comments/$_POST checking to a text file while working (calling a function in the php script that does this is the way I usually go) to prevent problems much like this. I found that there are variable issues with the jQM dynamically loading page content while hiding the HTML and displaying its own styles. Sometimes the page content is loaded from the DOM directly, avoiding your php scripts entirely...

Upvotes: 0

Related Questions