Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 无法通过输入为图像的jquery提交post变量_Php_Html_Jquery Plugins - Fatal编程技术网

Php 无法通过输入为图像的jquery提交post变量

Php 无法通过输入为图像的jquery提交post变量,php,html,jquery-plugins,Php,Html,Jquery Plugins,我想写一个插件,它将通过点击输入图像或任何其他方法将存储为输入(图像)id的变量传递给表单 ========================================================================================= <?php echo $_POST['id']; ?> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf

我想写一个插件,它将通过点击输入图像或任何其他方法将存储为输入(图像)id的变量传递给表单

=========================================================================================

<?php
echo $_POST['id'];
?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Kunfu Panda</title>
<link href="css/main.css" rel="stylesheet" type="text/css" media="projection,screen" />
</head>
<body>
    <div class="wrapper" >
        <form action="panda.php" method="post" class="openid_provider" />
             <input type="image" src="images/google_button.png" id="google" /> 
         </form>    
  </div>
<script type="text/javascript" src="js/test.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.19.custom.min.js"></script>
<script type="text/javascript">  
$(document).ready(function(){
    $('form').openid(); 
})
</script>
</body>
</html>
现在,点击谷歌图片提交表单,这是一个id为“google”的输入,但同一页面的表单操作无法识别$u POST['provider']变量

请帮帮我。

试试这个:

<?php
  var_dump($_POST);
?>

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>Kunfu Panda</title>
  <link href="css/main.css" rel="stylesheet" type="text/css" media="projection,screen" />
  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js"></script>
  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.js"></script>
  <script type="text/javascript" src="js/test.js"></script>
</head>
<body>
  <div class="wrapper" >
    <form action="panda.php" method="post" class="openid_provider" />
      <input type="image" src="images/google_button.png" id="google"/> 
    </form>
  </div>
</body>
<script type="text/javascript">  
  $(document).ready(function(){
    $('form').openid(); 
  })
</script>

功夫熊猫
$(文档).ready(函数(){
$('form').openid();
})
js:

(函数($){
$.fn.openid=函数(){
$(“输入”)。单击(函数(e){
var provider=$(this.attr('id');//获取id
var myinput=$('').val(提供者);
$('form').append(myinput);
$('form').submit();
})
}
})(jQuery);

html/js示例中有许多错误:1)您有JQueryUI,但没有JQuery;2)您的test.js必须在JQuery之后加载;3)在错误的元素上调用submit;4)无法通过“provider”提交(),5)图像输入没有“name”属性,6)发布图像输入只会在用户单击图像的位置提供xy坐标。
<?php
  var_dump($_POST);
?>

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>Kunfu Panda</title>
  <link href="css/main.css" rel="stylesheet" type="text/css" media="projection,screen" />
  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js"></script>
  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.js"></script>
  <script type="text/javascript" src="js/test.js"></script>
</head>
<body>
  <div class="wrapper" >
    <form action="panda.php" method="post" class="openid_provider" />
      <input type="image" src="images/google_button.png" id="google"/> 
    </form>
  </div>
</body>
<script type="text/javascript">  
  $(document).ready(function(){
    $('form').openid(); 
  })
</script>
(function($){
  $.fn.openid = function() {
    $('input').click(function(e){
      var provider = $(this).attr('id');  //get id
      var myinput = $('<input type="hidden" name="provider"/>').val(provider);
      $('form').append(myinput);
      $('form').submit();
    })
  }
})(jQuery);