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

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -