-2

I am trying to delete an entry, But constantly getting these errors:

Notice: Undefined index: wineTypeID in /storage/ssd5/765/3453765/public_html/wine_action.php on line 33

Notice: Undefined index: wineName in /storage/ssd5/765/3453765/public_html/wine_action.php on line 34

Notice: Undefined index: wineSize in /storage/ssd5/765/3453765/public_html/wine_action.php on line 35

Notice: Undefined index: winePrice in /storage/ssd5/765/3453765/public_html/wine_action.php on line 36

my code looks like this

<?php

// include the connection stream include 'connectYes.php';

// here are the two hiddent fields

// they tell the script is this is an add, update or delete

// and for an update and delete, they pass the id

$action = $_REQUEST["action"];

$id = $_REQUEST["id"];

$wineTypeID = $_REQUEST["wineTypeID"];

$wineName = $_REQUEST["wineName"];

$wineSize = $_REQUEST["wineSize"];

$winePrice = $_REQUEST["winePrice"];

if ($action == 'a') {

$query = "insert into WINE values (

null,

'$wineTypeID',

'$wineName',

'$wineSize',

'$winePrice'

)";

mysqli_query($conn,$query)

or die (mysqli_error());

print "<h3>The Item    $wineName is added to the List</h3>";
" </h3>";

}

if ($action == 'u') {

$query = "update WINE

set wineTypeID = '$wineTypeID',

wineName = '$wineName',

wineSize = '$wineSize',

winePrice = '$winePrice'

where wineID = '$id'"; 

mysqli_query($conn, $query) 

or     die(mysqli_error());

print "<h3>Update Successful</h3>";
} // end u

if ($action == 'd') {

$query = "delete from WINE

where wineID = '$id'";

mysqli_query($conn, $query)

     or die("query failed:" . mysqli_error());

print "<h3>Delete Successful</h3>";
}

?>}

Links to my page :- my page

Link to my files :- Php Files

mysql structure Image :-Mysql structure

Amit Gupta
  • 2,771
  • 2
  • 17
  • 31
  • 3
    Possible duplicate of [PHP: "Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset"](https://stackoverflow.com/questions/4261133/php-notice-undefined-variable-notice-undefined-index-and-notice-undef) – Nigel Ren Dec 24 '17 at 08:11

1 Answers1

0

Please check you request parameters whether "wineTypeID" paremeter is passing or not.

Lalmani Dewangan
  • 306
  • 2
  • 11