使用jQuery Mobile提交PHP表单
这是我的jquery移动应用程序代码。但是我用使用jQuery Mobile提交PHP表单,php,jquery,ajax,forms,jquery-mobile,Php,Jquery,Ajax,Forms,Jquery Mobile,这是我的jquery移动应用程序代码。但是我用phpresult创建的表单不起作用。表单未在提交时过帐数据。我甚至尝试了dataajax=“flase” 如果我冒昧猜测,那是因为你 <form id="stockupdate" method="post" action="medupdate.php"> 直接在表元素中(这是无效的标记)。将其移到表外(在之前)。创建无效标记时,浏览器引擎会尝试更正它,这可能会导致类似这样的问题 这就是chrome对您的标记所做的: 您不能遵循ht
php
result创建的表单不起作用。表单未在提交时过帐数据。我甚至尝试了dataajax=“flase”
如果我冒昧猜测,那是因为你
<form id="stockupdate" method="post" action="medupdate.php">
直接在表元素中(这是无效的标记)。将其移到表外(在
之前)。创建无效标记时,浏览器引擎会尝试更正它,这可能会导致类似这样的问题
这就是chrome对您的标记所做的:
您不能遵循html结构,即
表格中的表单
<table>
<form>
<tr>
<td>
</td>
</tr>
</form>
</table>
这是工作代码
表单php
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
</head>
<body>
<form id="stockupdate" method="post" action="medupdate.php" data-ajax="false">
<table>
<tr>
<td><input type="text" name="medbprice" value="xxxx" /></td>
<td><input type="text" name="medprice" value="yyyyy" /></td>
<td><input type="text" name="medstock" value="zzzzzz" /></td>
<td class="ui-screen-hidden"><input type="text" name="pid" value="111111" /></td>
<td>
<input type="submit" title="Update" data-icon="gear" data-theme="f" data-inline="true" data-iconpos="notext" />
</td>
</tr>
</table>
</form>
</body>
</html>
<?php
session_start();
$pid = $_POST['pid'];
$medbprice = $_POST['medbprice'];
$medprice = $_POST['medprice'];
$medstock = $_POST['medstock'];
echo $pid;
// your database operations
?>
medupdate.php
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
</head>
<body>
<form id="stockupdate" method="post" action="medupdate.php" data-ajax="false">
<table>
<tr>
<td><input type="text" name="medbprice" value="xxxx" /></td>
<td><input type="text" name="medprice" value="yyyyy" /></td>
<td><input type="text" name="medstock" value="zzzzzz" /></td>
<td class="ui-screen-hidden"><input type="text" name="pid" value="111111" /></td>
<td>
<input type="submit" title="Update" data-icon="gear" data-theme="f" data-inline="true" data-iconpos="notext" />
</td>
</tr>
</table>
</form>
</body>
</html>
<?php
session_start();
$pid = $_POST['pid'];
$medbprice = $_POST['medbprice'];
$medprice = $_POST['medprice'];
$medstock = $_POST['medstock'];
echo $pid;
// your database operations
?>
我们需要查看处理已发布值的代码。在您发布的代码中,我看不到一个$u POST全局变量。如果以上代码已完成,它将不会处理您的任何表单数据。。。在谷歌上搜索“PHP handle posted values”等@R.David这是一个手机应用程序还是一个支持jquery mobile的常规网站,以实现响应…?@SathyaRaj常规网站,支持jquery mobile进行响应。你是想写data ajax=“false”
还是真的有=“flase”
?我试过data ajax=“false”
。不管有谁回答我的问题。问题是
内部的
。这是一个有效的观点,但他实际上并没有处理代码中任何地方发布的值。