I could not figure it out what goes wrong. I need to pass the value of my checkbox( if is checked or not checked) , from page1.php to page2.php. Is only just one checkbox, not an array. Mention that either form action I cannot use.
This is the code from page1.php:
<?php
session_start();
$checked = 0; // not checked
$_SESSION['first'] = $checked;
echo "<input value='$checked' name='name' type='checkbox'> <span class='description'> Enable this?</span>";
?>
this is the code from page2.php:
<?php
session_start();
$checked = $_SESSION['first'];
if ( $checked == 1 ) {
echo ' checkbox checked ';
}
else
echo ' checkbox not checked ';
?>