How To Solve Undefined index error in PHP

Error
Notice: Undefined index: productid in /var/www/test/modifyform.php on line 32
Notice: Undefined index: name in /var/www/test/modifyform.php on line 33
Notice: Undefined index: price in /var/www/test/modifyform.php on line 34
Notice: Undefined index: description in /var/www/test/modifyform.php on line 35

Solution Use isset () function to your code just like below



<?php

if (isset($_POST['name'])) {
    $name = $_POST['name'];
}

if (isset($_POST['price'])) {
    $price = $_POST['price'];
}

if (isset($_POST['description'])) {
    $description = $_POST['description'];
}

?>

Comments

Popular posts from this blog

How to filter data from database according to client name & date wise in PHP

Captcha Code In PHP