" > 这里我的代码$rowC-6ren">
gpt4 book ai didi

php - 如何在同一页面上在php中编写获取值

转载 作者:行者123 更新时间:2023-11-29 23:52:10 27 4
gpt4 key购买 nike

嗨,我做了一个 php 代码,但它不起作用,我不知道为什么

这是我的代码

更新.php

<?php
$link=mysql_connect("localhost","root","root");
mysql_select_db("helixcrm",$link);
$q="select * from clientreg";
$ros=mysql_query($q);
$i=0;
while($row=mysql_fetch_array($ros))
{
if($i%2==0)
$classname="evenRow";
else
$classname="oddRow";
?>

<tr class="<?php echo $classname;?>">
<td><input type="checkbox" name="users[]" value="<?php echo $row["id"]; ?>" ></td>
</tr>
<?php
$i++;
}?>

<?php
$focus = array();
$rowCount = count($_Post["users"]);
echo $rowCount;
for($i=0;$i<$rowCount;$i++) {

$result = mysql_query("SELECT * FROM clientreg WHERE Id='" . $_POST["users"][$i] . "'");
$row[$i]= mysql_fetch_array($result);
//echo $row[$i]['interest'];
$focus = explode(',', $row[$i]['interest']);
$check = implode(',' , $focus);

// echo $check;
echo $row[$i]['id'];
}

?>

<form>
</form>

这里我的代码$rowCount = count($_Post["users"]);在这里不起作用,但如果我在另一个php页面上写它它可以工作

我哪里错了

我怎样才能实现我的输出

任何帮助将不胜感激

最佳答案

尝试这样做

    <?php
if (isset($_POST['submit'])) {
$example = $_POST['example'];
$example2 = $_POST['example2'];
echo $example . " " . $example2;
}
?>
<form action="" method="post">
Example value: <input name="example" type="text" />
Example value 2: <input name="example2" type="text" />
<input name="submit" type="submit" />
</form>

关于php - 如何在同一页面上在php中编写获取值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25575538/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com