Notice: Undefined index: userID in C:\xampp\htdocs\fuel_prepaid\editp

Avatar
  • updated
  • Answered

I am trying to preview my form that i have created, but when I preview it it gives me:

Notice: Undefined index: userID in C:\xampp\htdocs\fuel_prepaid\editprofile.php on line 46 at the top of my form.

this is my code:

Could not save account details!

');

}

mysql_close($connect);

}

}

?>

#header{

width:800px;

height:150px;

background-image:url(img/new.jpg)

}

#Navigation {

width:800px;

height:35px;

background-color:#F0F;

}

#Space{

width: 800px;

height: 300px;

background-color: #C96;

}

#Footer{

width:800px;

height:25px;

background-image:url(img/footer.gif)

}

a:link{color:#0FF;

text-decoration:overline

}

a:hover{

color:#F00;

text-decoration:line-through

}

#new_user {

border-left:#000 thin solid;

}

#Space #form1 table tr td table tr td {

font-family: Georgia, Times New Roman, Times, serif;

}

Registration

Home    News    Login    About Us

Please enter all registration details!

'; } if($allSaved === true) { print '

Your user account details have been saved.

'; } ?>

Registration
Please Register your username and password below!
Username :

Password :

 &#160

 

Existing users Log in here

Duplicates 1
Notice: Undefined index in Xampp installation
Notice: Undefined index: userID in C:\xampp\htdocs\Fuel\editprofile.php on line 47 Notice: Undefined index: birthdate in C:\xampp\htdocs\Fuel\editprofile.php on line 94 Notice: Undefined index: omang in C:\xampp\htdocs\Fuel\editprofile.php on line 101 Notice: Undefined index: postaladdress in C:\xampp\htdocs\Fuel\editprofile.php on line 110 Notice: Undefined index: email in C:\xampp\htdocs\Fuel\editprofile.php on line 118 Notice: Undefined index: email in C:\xampp\htdocs\Fuel\editprofile.php on line 123 Notice: Undefined index: cell in C:\xampp\htdocs\Fuel\editprofile.php on line 135 Notice: Undefined index: physicaladdress in C:\xampp\htdocs\Fuel\editprofile.php on line 144 Notice: Undefined index: country in C:\xampp\htdocs\Fuel\editprofile.php on line 153 ABOVE ARE THE OUTCOME OF THE BELOW CODE PLEASE ASSIT ME GUYS. THANKS IN ADVANCE 0) { $query = mysql_query("SELECT UserID, Title, Firstname, Surname,BirthDate, Omang/Passport_No., PostalAddress, Physical_Address, Country, Email, Cell, Username, Password FROM Users WHERE UserID=$_GET[userID];"); if($query) { while($row=mysql_fetch_row($query)) { $title = $row[1]; $firstname = $row[2]; $surname = $row[3]; $birthdate = $row[4]; $omang = $row[5]; $postaladdress = $row[6]; $physicaladdress = $row[7]; $country = $row[8]; $email = $row[9]; $cell = $row[10]; $username = $row[11]; $password = $row[12]; } } } if(isset($_POST['submitted'])) { if(trim($_POST['title']) === '') { $nameError = 'Please select ur your title!'; $hasError = true; } else { $firstname = trim($_POST['title']); } if(trim($_POST['firstname']) === '') { $nameError = 'Please type us your name!'; $hasError = true; } else { $firstname = trim($_POST['firstname']); } if(trim($_POST['surname']) === '') { $surError = 'Your surname is required...'; $hasError = true; } else { $surname = trim($_POST['surname']); } if(trim($_POST['birthdate']) === '') { $birthdateError = 'Please select your date of Birth!'; $hasError = true; } else { $birthdate= trim($_POST['birthdate']); } if(trim($_POST['omang']) === '') { $omangError = 'Please type your Omang or Passport No.!'; $hasError = true; } else { $omang = trim($_POST['omang']); } if(trim($_POST['postaladdress']) === '') { $postaladdressError = 'Please type your Postal Address!'; $hasError = true; } else { $postaladdress = trim($_POST['postaladdress']); } if(trim($_POST['email']) === '') { $emailError = 'Email is required!'; $hasError = true; } if(trim($_POST['email']) !== '') { if (!preg_match("/^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$/i", trim($_POST['email']))) { $emailError = 'You entered an invalid email address.'; $hasError = true; } else { $email = trim($_POST['email']); } } else { $email = ''; } if(trim($_POST['cell']) === '') { $cellError = 'Please type us your cell number!'; $hasError = true; } else { $cell = trim($_POST['cell']); } if(trim($_POST['physicaladdress']) === '') { $physicaladdressError = 'Please type us your Physical Address!'; $hasError = true; } else { $physicaladdress = trim($_POST['physicaladdress']); } if(trim($_POST['country']) === '') { $countryError = 'Please type us your country!'; $hasError = true; } else { $country = trim($_POST['country']); } if(trim($_POST['username']) === '') { $userError = 'Please provide a username!'; $hasError = true; } else { $username = trim($_POST['username']); } if(trim($_POST['password']) === '') { $passError = 'Password is needed!!!'; $hasError = true; } else { $password = trim($_POST['password']); } if(!isset($hasError)) { $userID = (int)$_GET["userID"]; if($userID > 0) { $confirmResult = mysql_query("UPDATE Users SET Title = '$title', Firstname='$firstname', Surname='$surname', BirthDate = '$birthdate', Omang/Passport_No. = $omang', PostalAddress = '$postaladdress', Physical_Address = 'physicaladdress', Country='$country', Email='$email', Cell = '$cell', Username='$username', Password='$password' WHERE UserID=$userID"); } else { header("location:editprofile.php"); } if($confirmResult) { $allSaved = true; header("location:Customer.php"); // redirect now } else { die('

Could not save account details!

'); } mysql_close($connect); } } ?>
Avatar
Arn
Hello JFlexx, Sorry for the problem with your Xampp installation. We unfortunately do not provide support for Xampp as it is not something that can be used within our hosting environment. However, I googled your error message and have found a possible answer for your listed issue. Check out this post for the possible solution. I hope that helps to answer your question! If you require further assistance, please let us know! Regards, Arnel C.
Avatar
-1
johnpaulb-imhs1
Hello JFlexx, Thank you for contacting us about an "undefined index" error on a form in your xampp server. Typically this error happens when you are attempting to use a variable that has not been defined yet. Unfortunately, we are unable to properly troubleshoot a xampp environment, since we do not have access. Here is a helpful link to our guide on How to create a custom PHP contact form with validation. It includes a successful example. Let us know if you have any further questions. Thank you, John-Paul