Hi all
I am doing a video tutorial on GET but I get a 'notice' that the tutor doesn't:
Notice: Undefined index: test in C:\xampp\htdocs\database\vartest2.php on line 2
Can I switch notifications like this off?
Here is the php code:
<?php
$var = $_GET["test"];
$len = strlen($var);
if ($len > 0)
{
echo $len;
}
else
{
echo "error: no input";
}
?>
<form action="vartest2.php" method="GET">
<input type="text" name="test">
<input type="submit" value="Submit">
</form>
This is what the tutor and I are entering into our browsers:
http://localhost/database/vartest2.php
(If I put ?test=anything at the end of the above, I don't get the notification but can't you just not specify ?test=... at the end?)
Displayed in my browser:
Notice: Undefined index: test in C:\xampp\htdocs\database\vartest2.php on line 2 error: no input
Displayed on the tutor's browser:
error: no input
I'm using Google Chrome Version 27.0.1453.94 m
Any help appreciated.
Regards,
Guy Brown