- This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Hello!
I have a search script and when i run it i receive this
( ! ) Notice: Undefined index: terms in search.php on line 15 and another on line 18
This is line 15 :
$nospaces = substr($_GET,0,4);
and this line 18:
if ($_GET == "") {
I run this on my localhost (WAMP last version)
If the array index “terms” doesn’t exist then this error will occur, what you need to do is the following…
if (isset($_GET) && !empty($_GET)) {
$nospaces = substr($_GET, 0, 4);
} else {
// Show an error message!
}
This will make sure the index exists otherwise it will show an error if you want it to.
@dynamyc, I don’t think such notice is an error in the world of PHP, it’s just a notice.
The simplest way is to ignore NOTICE in PHP:
error_reporting(E_ALL^E_NOTICE);
However, if you need to make it strict, follow @SgtLegend’s way.
@dynamyc, I don’t think such notice is an error in the world of PHP, it’s just a notice.
The simplest way is to ignore NOTICE in PHP:
error_reporting(E_ALL^E_NOTICE);
However, if you need to make it strict, follow @SgtLegend’s way.
Sorry, duplicated post due to network issue.
Anyone help to delete these?
thanks guys !