1

I'm having trouble accessing my pset7 website outside of the appliance. I completed pset6 and can access content from it just fine. I'm using windows 7 and have vmware2014. Here is the error I keep getting

( ! ) Notice: Undefined index: HTTP_HOST in /home/jharvard/vhosts
/pset7/includes/functions.php on line 198

Call Stack

#   Time    Memory  Function    Location

1   0.0004  127672  {main}( )   ../login.php:0

2   0.0006  128148  require( '/home/jharvard/vhosts/pset7/includes
/config.php' )  ../login.php:4

3   0.0018  130616  redirect( ) ../config.php:28

Note: This is my first time posting to stackexchange so I'd appreciate any constructive criticism if my question falls short of any of the site's guidelines.

1

A simple google search returned this result first:

PHP: "Notice: Undefined variable" and "Notice: Undefined index"

If you follow the link you will see a much more detailed explanation, but long answer short, you get this notice because PHP sees that you use a variable that might not have been initialized and may result in some security issue. To solve that, just use isset() before using the actual variable.

Example:

$value = isset($_POST['value']) ? $_POST['value'] : '';

The <expression> ? <value> : <value> is called a ternary operator and its use is the same as in C. If you have more questions about anything of this feel free to ask.


If this answers your question please accept it by clicking the gray check-mark to the left, so that it becomes green. You can also vote it up by pressing the up arrow above the check-mark. And don't forget to keep coding!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .