View Single Post
"if (isset($_SESSION['views'])&& $_SESSSION['views']==0)"

Du har en S for mye.

Her er et litt enklere variant av koden din:

Kode

<?php

session_start();

if (isset($_POST['stopcount']) && $_POST['stopcount'] == 1) {
  $_SESSION['views'] = 0;
  header('Location: http://localhost/mer-php/neocounter.php');
}
else {
  $_SESSION['views'] = (isset($_SESSION['views']) ? $_SESSION['views']++ : 0);
}
?>

<html><head><title></title></head>
<body bgcolor="grey">
<br><br>

<?php
echo "Antal besok:". $_SESSION['views'];
?>

<form action="" method="post">
<input type="checkbox" name="stopcount" value="1">Ja, nullstill
<input type="submit" value="send inn">
</form>

</body>
Sist endret av Yochi; 11. mai 2014 kl. 21:38. Grunn: Automatisk sammenslåing med etterfølgende innlegg.