条件式获取姓名
我正在做一个条件形式,据我所知,一切都是正确的,除了它不能正常工作。我试图将我的值传递到 if 语句中,但它只是没有得到它们,它一直回响我的 else 语句。
这就是我所拥有的
<form action="" method="post">
<select name="optionType" onChange="this.form.submit();">
<option value="Ben">Ben</option>
<option value="John">John</option>
<option value="Matt">Matt</option>
</select>
</form>
<table>
<?
for($x=2; $x<=count($excel->sheets[0]["cells"]); $x++) {
$date = $excel->sheets[0]["cells"][$x][1];
$user = $excel->sheets[0]["cells"][$x][2];
$type = $excel->sheets[0]["cells"][$x][3];
$keywords = $excel->sheets[0]["cells"][$x][4];
$keywordpage = $excel->sheets[0]["cells"][$x][5];
$urls = $excel->sheets[0]["cells"][$x][6];
$sitepr = $excel->sheets[0]["cells"][$x][7];
echo "\t<tr>\n";
if($user == $_POST['optionType']) {
echo "<td>";
echo $date = $excel->sheets[0]["cells"][$x][1];
echo "</td>\n";
echo "<td>";
echo $user = $excel->sheets[0]["cells"][$x][2];
echo "</td>\n";
echo "<td>";
echo $type = $excel->sheets[0]["cells"][$x][3];
echo "</td>\n";
echo "<td>";
echo $keywords = $excel->sheets[0]["cells"][$x][4];
echo "</td>\n";
echo "<td>";
echo $keywordpage = $excel->sheets[0]["cells"][$x][5];
echo "</td>\n";
echo "<td>";
echo $urls = $excel->sheets[0]["cells"][$x][6];
echo "</td>\n";
echo "<td>";
echo $sitepr = $excel->sheets[0]["cells"][$x][7];
echo "</td>\n";
}else{
echo 'Nothing at this time';
}
echo "\t</tr>\n";
}
?>
</table>
任何帮助表示赞赏 谢谢
Im doing a conditional form and as far as I can tell everything is correct except its just not working correctly. im trying to pass my values into a if statement and its just not getting them, it keeps echoing out my else statement.
This is what I have
<form action="" method="post">
<select name="optionType" onChange="this.form.submit();">
<option value="Ben">Ben</option>
<option value="John">John</option>
<option value="Matt">Matt</option>
</select>
</form>
<table>
<?
for($x=2; $x<=count($excel->sheets[0]["cells"]); $x++) {
$date = $excel->sheets[0]["cells"][$x][1];
$user = $excel->sheets[0]["cells"][$x][2];
$type = $excel->sheets[0]["cells"][$x][3];
$keywords = $excel->sheets[0]["cells"][$x][4];
$keywordpage = $excel->sheets[0]["cells"][$x][5];
$urls = $excel->sheets[0]["cells"][$x][6];
$sitepr = $excel->sheets[0]["cells"][$x][7];
echo "\t<tr>\n";
if($user == $_POST['optionType']) {
echo "<td>";
echo $date = $excel->sheets[0]["cells"][$x][1];
echo "</td>\n";
echo "<td>";
echo $user = $excel->sheets[0]["cells"][$x][2];
echo "</td>\n";
echo "<td>";
echo $type = $excel->sheets[0]["cells"][$x][3];
echo "</td>\n";
echo "<td>";
echo $keywords = $excel->sheets[0]["cells"][$x][4];
echo "</td>\n";
echo "<td>";
echo $keywordpage = $excel->sheets[0]["cells"][$x][5];
echo "</td>\n";
echo "<td>";
echo $urls = $excel->sheets[0]["cells"][$x][6];
echo "</td>\n";
echo "<td>";
echo $sitepr = $excel->sheets[0]["cells"][$x][7];
echo "</td>\n";
}else{
echo 'Nothing at this time';
}
echo "\t</tr>\n";
}
?>
</table>
Any help is appreciated
thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来问题出在
$_POST['userinfo']
上。您的选择框未命名为userinfo
。它被命名为optionType
。所以你永远不会从你的表单中传递用户。It looks like the issue is this
$_POST['userinfo']
. Your select box isn't nameduserinfo
. It's namedoptionType
. So you never get a user passed from your form.