简体   繁体   English

PHP SQL UPDATE在FF和CHROME中有效,但在IE中不起作用?

[英]PHP SQL UPDATE works in FF and CHROME but not in IE?

the below code works perfectly in FF and CHROME but not in IE. 下面的代码在FF和CHROME中完美运行,但在IE中则不行。 Please help. 请帮忙。 I have commented out my santize functions as i thought they might be affecting it, but it still does the same.... nothing in IE. 我已经注释掉了我的santize函数,因为我认为它们可能会影响它,但是它仍然可以实现同样的功能。 Thank you in advance for any assistance. 提前感谢您的任何帮助。

<?php 

//IF UPDATE BUCKET CHANGE STATUS...
if(isset($_POST['updatebucket'])){


 $complete = $_POST["complete"];
 $bucketid = $_POST["bucketid"];

//$complete = sanitizeone($_POST["complete"], "plain");
//$complete = strip_word_html($complete);
//$bucketid = sanitizeone($_POST["bucketid"], "plain");
//$bucketid = strip_word_html($bucketid);

if ($complete=="1")
  $complete = "0";
else
  $complete = "1";

$updatebucket = "UPDATE membersbuckets SET complete = '$complete' WHERE userid = '$userid' AND bucketid = '$bucketid'"; 
mysql_query($updatebucket);
}
?>

and the front end.... 和前端...。

<? if ($complete=="1") {
    echo "<form action='' method='post' name='updatebucket'><input name='complete' type='hidden' value=" .$complete. " /><input name='userid' type='hidden' value=" .$userid. " /><input name='bucketid' type='hidden' value=" .$bucketid. " /><input type='image' name='updatebucket' value='updatebucket' src='images/tick.png' /></form>";
    }else{
    echo "<form action='' method='post' name='updatebucket'><input name='complete' type='hidden' value=" .$complete. " /><input name='userid' type='hidden' value=" .$userid. " /><input name='bucketid' type='hidden' value=" .$bucketid. " /><input type='image' name='updatebucket' value='updatebucket' src='images/cross.png' /></form>";  
}
?>

Dan

You should post your front-end, not back-end (since it's pretty much not browser-dependant). 您应该发布前端,而不是后端(因为它与浏览器无关)。

Your HTML probably isn't valid. 您的HTML可能无效。

Edit: 编辑:

Yep, IE doesn't take value for image type of input. 是的,IE对于输入的图像类型没有价值。 It only sends the x & y (field_name_x, field_name_y) and totally discards the original "value" attribute. 它仅发送x&y(field_name_x,field_name_y),并且完全丢弃原始的“ value”属性。

Try with a hidden input instead. 请尝试使用隐藏的输入。

It seems that input type='image' doesn't send the value when used from IE. 从IE使用时, input type='image'似乎不发送该值。 You'll need another hidden field: 您将需要另一个隐藏字段:

<input type='hidden' name='updatebucket' value='updatebucket' />
<input type='image' src='images/tick.png' />

That way, the updatebucket parameter will be posted to the server, regardless of the browser used. 这样,无论使用什么浏览器,都会将updatebucket参数发布到服务器。

The assumption here was that all browsers handle HTML forms the same way (and they don't); 这里的假设是,所有浏览器都以相同的方式处理HTML表单(并且它们不这样做); that's why I keep Eric Lawrence's excellent Fiddler around - it can diff two HTTP requests, so you'll see the difference between the browsers immediately. 这就是为什么我会保留Eric Lawrence出色的Fiddler的原因-它可以区分两个HTTP请求,因此您会立即看到浏览器之间的区别。

另一种方法是检查$_POST[{image-element-name}_x}] (在本例中$_POST['updatebucket_x'] 。所有浏览器都将图像元素的x / y坐标作为updatebucket.xupdatebucket.y ,和PHP默默的(和令人沮丧的)改变updatebucket.xupdatebucket_x 。再说,你只需要这一下不同的输入类型=提交/类型=图像元素会改变所采取的行动,否则的以前的解决方案如先前建议的隐藏元素可以。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PHP自提交表单在FF和Chrome中运行但不在IE中运行(404错误) - PHP Self Submitting Form Works in FF and Chrome but not IE (404 error) IE中未填充列表框可在FF和Chrome中运行 - listbox not being populated in IE works in FF and Chrome Jeditable无法在IE中使用,但可以在FF,Chrome中使用 - Jeditable not working in IE, but works in FF, Chrome 用于自动登录的jQuery .submit适用于FF,Chrome ...而不是IE - jQuery .submit for autologin works in FF,Chrome… not IE PHP Form无法在IE和Chrome上正常运行,但在FF中可以正常使用 - PHP Form not working IE and Chrome, but fine in FF 我的php注销功能在IE或FF中不起作用。 在Chrome中可完美运行 - My php logout function doesn't work in IE or FF. Works beautifully in Chrome php代码在ie上的表单提交上不起作用(但在chrome,ff上工作正常) - php code doesn`t work on form submit on ie (but works fine on chrome, ff) 文件上传在IE中不起作用,但在FF,Chrome和Safari中有效 - File upload not working in IE, but works in FF, Chrome, and Safari 显示变量在IE中出错,在FF / Chrome等系统中有效 - Displaying variable goes wrong in IE , works in FF/Chrome etc IE / FF上缺少HTTP Referrer信息(在Chrome / Safari上运行良好) - Missing HTTP Referrer info on IE/FF (works well on Chrome/Safari)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM