I know there is a lot of threads already on this website, but I cant find any that remotely looks like it'd be help to me.

I am getting frustrated over this bit of code error. Any help would be appreciated.

php line 64

$emails = $_REQUEST['email'];


$data = mysql_query("SELECT current_image, email FROM employees where email='$emails'") or die(mysql_error());
//Puts it into an array
while($info = mysql_fetch_array( $data )) { //Outputs the image and other data

Notice: Undefined index: email in /var/www/vhosts/numyspace.co.uk/web_users/home/~unn_u020672/public_html/assignment/user/members.php on line 64


I am asking it to take email and current image from my database, trying to return an image that relates to the email of a user.


Thanks, S

Member Avatar for diafol

It means that a form field or querystring parameter called email doesn't exist. You should avoid using $_REQUEST - use $_POST or $_GET.

Where is $_REQUEST coming from? A form, a querystring? It appears to be none of these in your case.

It often pays to use an if statement to check the existence of a $_POST array.

Thanks for the reply.

Basically i want the return to be email='$emails'" and i declared the variable ($email)

email is in the mysql database
i am going to ask it to return the image that relates to the email address.


there is no form, it's for a user profile so the user's image will be displayed for the user's email address.

Member Avatar for diafol

THe whole point is

$emails = $_REQUEST['email'];

The $_REQUEST doesn't exist.

how do I call the $emails variable then from the field known as 'email' in my database

Member Avatar for diafol

Well, it depends what you're trying to do. Usually somebody logs in and has their id stored in a session variable. You then use that stored session variable to get the data (email etc) from the DB.

It's not clear what you're trying to achieve here. The $emails has to come from somewhere. AFAIK, you aren't giving it a value anywhere.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.