•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 425,934 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,626 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 819 | Replies: 2
![]() |
•
•
Join Date: Mar 2007
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
Hi everyone.
i'm having the following problem with the PHP code that i'm writing:
Notice: Undefined index: email in c:\program files\easyphp1-8\www\gestao_perfil.php on line 15
Notice: Undefined index: password in c:\program files\easyphp1-8\www\gestao_perfil.php on line 22
Here is the code:
The idea is to fetch values from a database and in the end update the database with new ones(i know that the last part isn't finnish yet). Why am i getting these messages on my web browser?
Can someone help me to find waht's wrong with the code?
i'm having the following problem with the PHP code that i'm writing:
Notice: Undefined index: email in c:\program files\easyphp1-8\www\gestao_perfil.php on line 15
Notice: Undefined index: password in c:\program files\easyphp1-8\www\gestao_perfil.php on line 22
Here is the code:
PHP Syntax (Toggle Plain Text)
<?php parse_str ($_SERVER['QUERY_STRING']); //Tenta estabelecer uma ligação ao servidor MySQL @mysql_connect("localhost","root","") or die("Não foi estabelecida uma ligação ao servidor MySQL!"); //Tenta celeccionar a base de dados 12in @mysql_select_db("12in") or die("Não foi possivel seleccionar uma base de dados"); // declaração de variáveis, query á base de dados, resultado da query atribuidos ás variáveis $mail $passwd if (isset ($_POST['email'])) $email = $_POST['email']; { $email = $_POST['email']; $query = "SELECT mail FROM utilizador WHERE mail='$email'"; $result = mysql_query($query); $mail= @MYSQL_RESULT($result,0,"email"); } if (isset ($_POST['password'])) $password = $_POST['password']; { $password = $_POST['password']; $query = "SELECT password FROM utilizador WHERE password='$password'"; $result = mysql_query($query); $passwd = @MYSQL_RESULT($result,0,"password"); } ?>
The idea is to fetch values from a database and in the end update the database with new ones(i know that the last part isn't finnish yet). Why am i getting these messages on my web browser?
Can someone help me to find waht's wrong with the code?
Take a look at the form that is getting submitted.. My guesse is that you are using the GET method rather than the POST method. The error indicates you are trying to access an array index that does not exsist.
Two ways to fix this would be change your $_POST to $_GET or goto the form and set method equal to post. (<form action="me.html" method="POST">)
If not check the names of your form fields. The must match the names of the index you are using in the array.
I.E.
<input type="text" name="email">
<?php
$_POST['email'];
?>
They must match
Two ways to fix this would be change your $_POST to $_GET or goto the form and set method equal to post. (<form action="me.html" method="POST">)
If not check the names of your form fields. The must match the names of the index you are using in the array.
I.E.
<input type="text" name="email">
<?php
$_POST['email'];
?>
They must match
Last edited by GliderPilot : May 1st, 2007 at 10:56 pm. Reason: Spelling
•
•
Join Date: Feb 2007
Location: Palmerston North, New Zealand
Posts: 16
Reputation:
Rep Power: 2
Solved Threads: 2
I'm not exactly sure. However, there is a way to get the query to say if there is an error with that.
[PHP]if(!$result){die(mysql_query());} // This will halt the script and display the sql error if the query failed to run[/PHP]
You should be able to then see if you have some sort of error with your query, or if it is because of something else.
[PHP]if(!$result){die(mysql_query());} // This will halt the script and display the sql error if the query failed to run[/PHP]
You should be able to then see if you have some sort of error with your query, or if it is because of something else.
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
access activation api blog blogger blogging blogs code combo competition dani daniweb data debugging development dreamweaver dropdownlist gdata gentoo google gpl html innovation key linux microsoft module net news openbsd php product programming reuse rss security serial source spam tags vista web wysiwyg xml
- mysql errors, from submit.php and index.php (PHP)
- index.php?p="Whatever" (PHP)
- IE Address Bar hijacked by http://s5.th.msie.cc/ index.php (CWShredder.exe) (Viruses, Spyware and other Nasties)
- http://www.th.msie.cc/ index.php?aid=579 (Viruses, Spyware and other Nasties)
- IE is hijacked by http://th.msie.cc/index.php?aid=20035 (Viruses, Spyware and other Nasties)
Other Threads in the PHP Forum
- Previous Thread: MySql commands in a text file
- Next Thread: Getting Info. for specific record?


Linear Mode