In my web system, I have 3 files: database.php, functions.php, dashboard.php
This is what my dashboard.php file looks like
<?php $i=NULL; if(isset($_POST['next'])) { $i=getQuizes($i); } ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <input name="next" value="Next" type="submit"> </form>
functions.php as below
function getQuizes($quizNo) { if($quizNo==NULL) { $quizNo=0; } include_once('database.php'); $sql = "SELECT * FROM quiz LIMIT ".$quizNo.",1"; $result = $conn->query($sql); while($row=$result->fetch_assoc()) { echo $row['question'],$quizNo; } $quizNo++; return $quizNo; }
when I clicked on the submit button data, go to the functions.php file and go back to dashboard.php, then again $ i will become NULL. I can only assign NULL for the first time. If so, how can I do this.
php
Isuruab
source share