This question already has answers here:
"Notice: Undefined variable", "Notice: Undefined index", "Warning: Undefined array key", and "Notice: Undefined offset" using PHP
(29 answers)
Closed 8 years ago.
Im getting the following error: Notice:undefined index:done
please advise what is wrong
<?php
if($_Get['done']==1 $msg = "Account details saved";
?>
Check first if the key exists, then the comparison to 1.
if (isset($_GET['done']) && $_GET['done'] == 1) {
$msg = '...';
}
Related
This question already has answers here:
"Notice: Undefined variable", "Notice: Undefined index", "Warning: Undefined array key", and "Notice: Undefined offset" using PHP
(29 answers)
Closed 2 years ago.
So here is the code. I get error such as "Undefined index: fad in C:\wamp\www*imdone.php* on line ..."
But the link is - http://localhost/exercises.php?page=htmlex&get=imdone#container.
Hope i could explain barely
$folder = 'test/';
$uploadingfile = $folder . basename($_FILES['fad']['name']);
if (move_uploaded_file($_FILES['fad']['tmp_name'], $uploadingfile))
{
echo "Upload successfully.<br>";
} else {
echo "Upload unsuccesfully\n";
}
The 'fad' in the $_FILES['fad']['name'] is suppose to be the name of your input type=file field in the form. You should first double check with your form to confirm the name.
This question already has answers here:
"Notice: Undefined variable", "Notice: Undefined index", "Warning: Undefined array key", and "Notice: Undefined offset" using PHP
(29 answers)
Closed 4 years ago.
i had a problem in this line, because the error message tell me theres an undefined index:
$strSQL = " UPDATE place SET
rating_value = '".$_POST["rating_value"]."'
WHERE place_id = '".$_POST["place_id"]."'
";
pls help me if you have a solution. thanks
Do you check your variables before do the request like :
if( !empty($_POST["rating_value"]) && !empty($_POST["place_id"]) )
{
// your request
} else {
echo("error");
}
This question already has answers here:
"Notice: Undefined variable", "Notice: Undefined index", "Warning: Undefined array key", and "Notice: Undefined offset" using PHP
(29 answers)
Can I mix MySQL APIs in PHP?
(4 answers)
Closed 5 years ago.
I'm having a problem here
This is my forgot pass.php code
<?php
if(isset($_POST['submit_email']) && $_POST['email'])
{
require 'connect.php';
include 'connect.php';
$select=mysqli_query($con, "SELECT * from `users` where email='$email'");
if(mysqli_num_rows($select)==1)
{
while($row=mysql_fetch_array($select))
{
$email=($row['email']);
$pass=md5($row['password']);
}
I'm getting the error Undefined variable: email on line 6.
Thanks in advance for helping
This question already has answers here:
"Notice: Undefined variable", "Notice: Undefined index", "Warning: Undefined array key", and "Notice: Undefined offset" using PHP
(29 answers)
Closed 6 years ago.
I am getting an undefined index error on this line of code:
switch ($_REQUEST["___p"])
I think I would need to declare the variable. What would I change the above line to?
Either make sure exists beforehand with isset() or just ignore it:
switch (#$_REQUEST["___p"])
This question already has answers here:
"Notice: Undefined variable", "Notice: Undefined index", "Warning: Undefined array key", and "Notice: Undefined offset" using PHP
(29 answers)
Closed 7 years ago.
Can anyone tell me where is the syntax error of the following code:
echo "<td bgcolor=.$cores[i].></td>";
$cores is an array of colors codes:
$cores = array("#FF0000","#FFBF00","#FFFF00","#04B404","#58FAF4","#0101DF","#8A0886");
try this:
echo "<td bgcolor={$cores[$i]}></td>";