jquery移动发布表单内容,但不会打印


jquery mobile posting form content but wont print

我的代码有一个奇怪的问题。我正在尝试为用户创建一个表单来编辑他们的个人资料信息。这是一个简单的形式,就像下面的来源一样。

我使用模板,每个页面都会进入索引.php页面将被构建。

问题是这样的:我在索引中放置了一个print_r来打印_POST以查看是否发布了任何内容。但是当我提交表格时,什么都没有发布。当我将print_r放在模板中时,print_r突然出现,好像没有任何问题,并且表单已发布。:S

我尝试将操作设置为不同的页面,但没有效果。

我也有一个登录表单,由于某种原因该表单工作正常。 但是当我将其放入edit_profile模板中时,它停止工作。

这是edit_profile页面的源代码。

<!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="example@example.com"/>
                   <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>

希望你们能帮助我。如果有任何问题,请告诉我。

你的HTML看起来不错,它应该是jQM就绪的。我使用过jQM/php/MySQL一些工作,所以我知道它的一些怪癖。

我建议现在通过编写您的注释/$_POST在工作时检查到文本文件来避免这个问题(在php脚本中调用一个函数来执行此操作是我通常的方式),以防止出现这样的问题。我发现 jQM 在隐藏 HTML 并显示自己的样式时动态加载页面内容存在可变问题。有时页面内容直接从 DOM 加载,完全避免了您的 php 脚本......