dongshan0202405 2012-04-30 19:08
浏览 32
已采纳

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

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="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>

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

  • 写回答

1条回答 默认 最新

  • dqol6556 2012-04-30 19:28
    关注

    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...

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大