In the below script you see a string length counter This script is working fine but i have a problem When first time i open this page in my browser it show an error in line 2 (explained in image 2) But when u enter the test string the error removed I can't remove the 'test' variable b'coz i have to work with it Can anybody help me to to remove this erro line in the browser Image 1 Image 2 Image 3
That's a notice, not an error. You have to check that the element exists in the array first. Instead of: $var = $_GET["test"]; $len = strlen($var); PHP: You would do: if (isset($_GET["test"])) { $var = $_GET["test"]; $len = strlen($var); } else { $var = ""; $len = 0; } PHP: