Sunday, 14 May 2017
php - How to fix Notice: Undefined index in PDO
Answer
Answer
i have
Notice: Undefined index: _ava in C:\xampp\htdocs\otakutangerang_admin\edit_user.phpon line 26
$avatar = $_POST['_ava'];
Notice: Undefined index: _skill in C:\xampp\htdocs\otakutangerang_admin\edit_user.php on line 27
$usr_skill = $_POST['_skill'];
and this my code
if (isset($_POST['update'])) {
$id = $_GET['id'];
$email = $_POST['_em'];
$fname = $_POST['_fn'];
$lname = $_POST['_ln'];
$web_usr = $_POST['_web'];
$usr_note = $_POST['_note'];
$avatar = $_POST['_ava'];
$usr_skill = $_POST['_skill'];
//Retrieve the user account information by id.
if ($object->Update($id, $email, $fname, $lname, $web_usr, $usr_note, $avatar, $usr_skill)) {
$msg = "WOW! Record was updated successfully HOME!";
} else {
$msg = "SORRY! ERROR while updating record !";
}
}
if (isset($_GET['id'])) {
$id = $_GET['id'];
extract($object->Details($id));
}
This my form to change and edit the database
Answer
use isset()
$avatar = isset($_POST['_ava']) ? $_POST['_ava'] : null;
$usr_skill = isset($_POST['_skill']) ? $_POST['_skill'] : null;
and same other post value . hope it will help you
for more information
http://php.net/manual/en/function.isset.php
Subscribe to:
Post Comments (Atom)
c++ - Does curly brackets matter for empty constructor?
Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...
-
Iv'e read a lot of posts both in stackoverflow and other websites talking about web security. Such as salting encrypting etc. ...
-
System.out.print("Name : "); String name = in.nextLine(); System.out.print("Age : "); int age = ...
-
In K-PAX , there are two possible explanations: Prot is crazy. He is truly an alien. There are facts that indicate 1, but also 2. Examples: ...
No comments:
Post a Comment