Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/250.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从输入html表单中获取值_Php - Fatal编程技术网

如何使用php从输入html表单中获取值

如何使用php从输入html表单中获取值,php,Php,是否有人可以帮助我在提交表单后如何从输入名称=“$photo_id”获取以下状态的值。。应该是$photo\u id=$\u GET['photo\u id'],在下一页 $picture = mysql_query( "SELECT * FROM gallery_photos where photo_category = ".$cid." "); while($row2 = mysql_fetch_array($picture)){ $photo_id = $row2["ph

是否有人可以帮助我在提交表单后如何从输入名称=“$photo_id”获取以下状态的值。。应该是$photo\u id=$\u GET['photo\u id'],在下一页

$picture = mysql_query( "SELECT * FROM gallery_photos where photo_category = ".$cid."    ");
while($row2 = mysql_fetch_array($picture)){ 

    $photo_id = $row2["photo_id"];
    $photo_filename = $row2["photo_filename"];
    $photo_caption = $row2["photo_caption"];
    $photo_category = $row2["photo_category"];

    echo "<ul style='float:left; list-style:none; '>";
    echo "<li><img src='".$images_dir."/tb_".$photo_filename."' border='0' alt='".$photo_caption."' /><br />";
    echo "<span><input name='$photo_id' type='text' value='$photo_caption' /></li></span>";
    echo "</ul>";
    }
$picture=mysql\u query(“从照片库中选择*,其中照片类别=“.cid.”);
而($row2=mysql\u fetch\u数组($picture)){
$photo_id=$row2[“photo_id”];
$photo_filename=$row2[“photo_filename”];
$photo_caption=$row2[“photo_caption”];
$photo_category=$row2[“photo_category”];
echo“
    ”; 回声“

  • ”; 回声“
  • ”; 回声“
”; }

Thx:)

这是非常直接的-HTML101

这里唯一缺少的是

<form> </form> tags
标签
改变最后5行如下,它应该工作的方式,你想要的

echo '<form method="get" action="next_file.html" >';
echo "<ul style='float:left; list-style:none; '>";
echo "<li><img src='".$images_dir."/tb_".$photo_filename."' border='0' alt='".$photo_caption."' /><br />";
echo "<span><input name='$photo_id' type='text' value='$photo_caption' /></li></span>";
echo "</ul>";
echo "</form>";
}
echo';
echo“
    ”; 回声“

  • ”; 回声“
  • ”; 回声“
”; 回声“; }
希望对你有所帮助, 干杯。

添加
标签

分为两个输入:

<input name='photo_caption' type='text' value='$photo_caption' />
<input name='photo_id' type='hidden' value='$photo_id' />

如果你可以发布页面,你可以从
$\u post
数组中获取它,否则你必须传入url,比如=$\u get['photo\u id';使用php头函数

$photo_caption = $_POST['photo_caption'];
$photo_id = $_POST['photo_id'];