Notice: Undefined variable: who in /home/ pr0blem can't solve

Started on the old forum in April 2010 · view the original in the archive · old links redirect here

21 replies · 979 views · started 16 years ago · 1 min read

TL;DR · summary of 21 replies
  • Undefined variable $who was fixed by declaring and initializing it with a null or empty value.
  • Another undefined index issue with $_POST array was also addressed.
  • The error was not considered important, so hiding the errors using error_reporting() was suggested.

Written automatically from the replies by a language model on our own server. It can be wrong; the posts below are the source.

6 participants
razzbee Developer · 130 posts #21

Older versions of PHP will ignore this type of errors but all the currents versions of PHP are made to work somehow like c++ and Java.Because in Java and c++,U will need to declare a variable before initializing it.Its is very much recommended.Its very annoying doing it but programmers in C++ and Java will see it normal. So here U were to declare :

$who="";

We declared $who to null or empty variable.After declaring it to an empty variable,You then asign $_POST to it so it will be

$who="";
$who=$_POST['who'];

As Gumslone to said,the error is not of important so U can decide to hide it using :

error_reporting("E^NOTICE");

it is not recommended to hide all errors ,so I will not advise you to use

error_reporting("E^ALL"); or error_reporting(0);
just_m3. Developer · 199 posts #22

GumSlone was right from the first place you just didn't get it

this error is not important just remove ~E_NOTICE from error reporting.

by removing it means

// Report all errors except E_NOTICE // This is the default value set in php.ini error_reporting(E_ALL ^ E_NOTICE);

This is ten percent luck, twenty percent skill Fifteen percent concentrated power of will Five percent pleasure, fifty percent pain 😂And a hundred percent reason to remember the name!

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close