我正在使用一个表单来从3张图片中进行选择,然后将其发送到PHP页面,但是$_POST['stars'];
并没有传送过去。
<form action="components/update_score.php" method="POST">
<input type="image" name="stars" src="imagenes/th/0.png" value="0" width="120" />
<input type="image" name="stars" src="imagenes/th/1.png" value="1" width="120" />
<input type="image" name="stars" src="imagenes/th/2.png" value="2" width="120" />
<input type="image" name="stars" src="imagenes/th/3.png" value="3" width="120" />
<input type="hidden" name="war_enemy" value="<?php echo $rws['war_enemy'];?>" />
<input type="hidden" name="user_username" value="<?php echo $user_score;?>" />
<input type="hidden" name="enemy_enemynumber" value="<?php echo $i;?>" />
</form>
并且在php上
<?php
ini_set("display_errors",1);
session_start();
if(isset($_POST)){
echo $_POST['stars'],'<br>';
echo $_POST['war_enemy'],'<br>';
echo $_POST['user_username'],'<br>';
echo $_POST['enemy_enemynumber'],'<br>';
}
?>
发送此内容会让我收到“注意:未定义索引:stars”的通知。我不想使用提交按钮,而是想使用图片来完成,但找不到将帖子发送到php的方法。感谢任何帮助。
var_dump($_POST)
并查看您拥有的内容。 - Cully