Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/243.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/82.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 为孩子计算网站,会话重置_Php_Html_Session_Calculator - Fatal编程技术网

Php 为孩子计算网站,会话重置

Php 为孩子计算网站,会话重置,php,html,session,calculator,Php,Html,Session,Calculator,为了上学,我必须为孩子们制作一个计算网站。到目前为止,除了最重要的部分——计算之外,一切都正常。到目前为止,我想出了这个。(我知道这并不是一个干净的代码。我对这一点非常陌生,我就是搞不懂。) 这个想法是,你得到10个问题(随机)在10个问题后,你应该看看有多少答案是正确的$vraagnr需要计算您有多少问题,以及$goed有多少问题是正确的 我希望你能给我一些建议。试试这样的方法,我在学校,我不能真正测试我写的代码,但你应该遵循这种结构 while($couter < 10) { $n

为了上学,我必须为孩子们制作一个计算网站。到目前为止,除了最重要的部分——计算之外,一切都正常。到目前为止,我想出了这个。(我知道这并不是一个干净的代码。我对这一点非常陌生,我就是搞不懂。)


这个想法是,你得到10个问题(随机)在10个问题后,你应该看看有多少答案是正确的
$vraagnr
需要计算您有多少问题,以及
$goed
有多少问题是正确的


我希望你能给我一些建议。

试试这样的方法,我在学校,我不能真正测试我写的代码,但你应该遵循这种结构

while($couter < 10) {
$numberone = rand(5, 15); 
   $numbertwo = rand(5, 15); 
$answer = $numberone + $numbertwo;

echo "De vraag is: Hoeveel is <?php echo $numberone . " + " . $numbertwo;?>";

if ($answer == $input) als het antwoord juist is..
else als het antwoord niet juist is..

$counter++;
}
while($couter<10){
$numberone=兰特(5,15);
$numbertwo=兰特(5,15);
$answer=$numberone+$numbertwo;
回声“德弗拉格是:霍维尔是”;
如果($answer==$input)是。。
否则,安特沃德·尼特·朱伊斯特就。。
$counter++;
}

如果($answer==$input),我想我应该把表单放在上面,因为否则它不会识别$input?您的主要问题是您正在从
$\u会话['goed']
读取内容,但从未分配回它-如果答案正确,您需要将
$goed
的值添加回会话中。
while($couter < 10) {
$numberone = rand(5, 15); 
   $numbertwo = rand(5, 15); 
$answer = $numberone + $numbertwo;

echo "De vraag is: Hoeveel is <?php echo $numberone . " + " . $numbertwo;?>";

if ($answer == $input) als het antwoord juist is..
else als het antwoord niet juist is..

$counter++;
}