First timer PHP edit to update html, some errors -
this first time using php in real project environment. project pretty simple, take existing, working php site , update html consistent html5. after designing html, inserting php previous site. works of time, few errors. instance:
<? $sec = $_get['sec']; if ($sec == "1") { echo ('success!'); } ?>
is causing error: notice: undefined index: sec in /file_that_holds_site_build.
of course if url doesn't include append tag (=1) alerts message.
so question this, missing causes $get
when there no $sec
? how eliminate error on first page load?
you're getting notice because you're trying access array index doesn't exist in scenarios. here's how should getting data out of request.
$sec = array_key_exists('sec', $_get) ? $_get['sec'] : null;
Comments
Post a Comment