Skip to content Skip to sidebar Skip to footer

Php Error And Even After Defining Variable

this is my block of code for insert product of my project ]) ? $_POST['product_price'] : '';

Solution 2:

fixed my error. Just added this after taking some advice from all my replies i got. Thanks everyone.

$product_title=mysqli_real_escape_string($conn,$_POST['product_title']);
    $product_cat=mysqli_real_escape_string($conn,$_POST['product_cat']);
    $cat=mysqli_real_escape_string($conn,$_POST['cat']);
    $product_price =mysqli_real_escape_string($conn,$_POST['product_price']);
    $product_desc=mysqli_real_escape_string($conn,$_POST['product_desc']);
    $product_keyword=mysqli_real_escape_string($conn,$_POST['product_keywords']);

Solution 3:

This happens because "product_price" does not exist on $_POST.

To avoid this error, check if it exists first using isset():

$product_price = isset($_POST['product_price']) ? $_POST['product_price'] : '';

Post a Comment for "Php Error And Even After Defining Variable"