我已经看到了对此的引用,但是我不完全确定如何将其与数组集成并且仍然具有正常运行的系统.我想每次用户按下按钮时更改$place和$title的值,并且我知道我需要if语句和某种方式处理表单(PHP中无点击),但是我不需要除此之外,还知道什么.我在下面粘贴了我的PHP和HTML按钮:
StatsCalc V1$place = 0;
$title = 0;
echo '
Statistics Calculator: Version 1
$links = array('
', "", "");echo $links[$place];
/*if($_GET){
if(isset($_GET['clickies'])){
$place = 1;
$title = 1;
}
}*/
if($_POST['clickies'] and $_SERVER['REQUEST_METHOD'] == "POST"){
$place = 1;
$title = 1;
}
$subtitle = array('
Standardised Score
Standard Deviation
Averages
echo $subtitle[$title];
?>
解决方法:
也许这可以让您知道如何执行此操作.
if($_SERVER['REQUEST_METHOD'] == "POST") {
if (isset($_POST['clickies'])) {
$count = intval($_POST['count']);
$count ;
$place = $count;
$title = $count;
}
} else {
$place = 0;
$title = 0;
}
echo '
Statistics Calculator: Version 1
$links = array('
', "", "");echo $links[$place];
echo $place; echo "
";
$subtitle = array('
Standardised Score
Standard Deviation
Averages
echo $subtitle[$title];
?>
我要做的是将按钮放在表单内,然后放置method = post
并将其提交到同一页面
我还将计数存储在一个隐藏的输入中,并在提交表单时始终将其传递,并在表单上更新其值,
尝试根据您的需要进行修改来源:https://www.icode9.com/content-1-531101.html