I try to determine if a checkbox is checked or not, but i get an error.
test.php
<html>
<body>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
Use Proxy : <input type="checkbox" name="use_proxy"><br><br>
<input type="submit">
</form>
<?php
$use_proxy = $_POST['use_proxy'];
if ($use_proxy != "on")
{
$use_proxy = "off";
}
echo "<p> use_proxy = " . $use_proxy . "</p><br>";
?>
</body>
</html>
I get this error: Notice: Undefined index: use_proxy in C:\xampp\htdocs\mbcl\checkbox_test.php on line 11 How can i solve it?