Some Errors I am having trouble with
Notice: Undefined index: dValue in C:\xampp\htdocs\Self Exercise\proj\order.php on line 20
Notice: Undefined variable: id in C:\xampp\htdocs\Self Exercise\proj\order.php on line 31


Notice: Undefined variable: name in C:\xampp\htdocs\Self Exercise\proj\order.php on line 15

Notice: Undefined variable: name in C:\xampp\htdocs\Self Exercise\proj\order.php on line 17

    <?php 
    
    session_start(); 
    include("Connection.php");
    	if (isset($_POST['submit']))  
    	$name = $_POST['customerName'];
    	mysql_query("INSERT INTO  `starbucks`.`orders` (
    `ID` ,
    `NAME` ,
    `TOTAL_PRICE` ,
    `TOTAL_ITEMS` ,
    `TIME`
    )
    VALUES (
    '' ,  '$name',  '', '',NOW())");
    	
    $_SESSION['user'] = $name; 
    	
    $dTime = time();
    $myValue = $_REQUEST['dValue'];
    echo "The time is: {$dTime}<br/>
    The choice is {$myValue} ";
    
    $sql = "Select * from product where NAME = '{$myValue}'";
     $result = mysql_query($sql);
    while ($row = mysql_fetch_assoc($result)){
        $price = $row['PRICE'];
        $id = $row['ID'];
        echo $id;
    }
    $sql2 ="INSERT INTO `starbucks`.`order_details` (`ID`, `ORDER_ID`, `PRODUCT_ID`, `QTY`) VALUES ('', '', '$id', '1')";
    
    $result2 = mysql_query($sql2);
    	?>

here's my code for the JS

    function change_sidebar(dElement) {
    	//alert ("oist");
    	var xmlhttp;
    	if (window.XMLHttpRequest)
    	  {// code for IE7+, Firefox, Chrome, Opera, Safari
    	  xmlhttp=new XMLHttpRequest();
    	  }
    	else
    	  {// code for IE6, IE5
    	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    	  }
    	xmlhttp.onreadystatechange=function()
    	  {
    	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    		{
    		document.getElementById("tochange").innerHTML=xmlhttp.responseText;
    		}
    	  }
    	xmlhttp.open("GET","order.php?dValue="+dElement.defaultValue,true);
    	xmlhttp.send();
    }
Some Errors I am having trouble with
===

Notice: Undefined index: dValue in C:\xampp\htdocs\Self Exercise\proj\order.php on line 20
Notice: Undefined variable: id in C:\xampp\htdocs\Self Exercise\proj\order.php on line 31


Notice: Undefined variable: name in C:\xampp\htdocs\Self Exercise\proj\order.php on line 15

Notice: Undefined variable: name in C:\xampp\htdocs\Self Exercise\proj\order.php on line 17

    <?php 
    
    session_start(); 
    include("Connection.php");
    	if (isset($_POST['submit']))  
    	$name = $_POST['customerName'];
    	mysql_query("INSERT INTO  `starbucks`.`orders` (
    `ID` ,
    `NAME` ,
    `TOTAL_PRICE` ,
    `TOTAL_ITEMS` ,
    `TIME`
    )
    VALUES (
    '' ,  '$name',  '', '',NOW())");
    	
    $_SESSION['user'] = $name; 
    	
    $dTime = time();
    $myValue = $_REQUEST['dValue'];
    echo "The time is: {$dTime}<br/>
    The choice is {$myValue} ";
    
    $sql = "Select * from product where NAME = '{$myValue}'";
     $result = mysql_query($sql);
    while ($row = mysql_fetch_assoc($result)){
        $price = $row['PRICE'];
        $id = $row['ID'];
        echo $id;
    }
    $sql2 ="INSERT INTO `starbucks`.`order_details` (`ID`, `ORDER_ID`, `PRODUCT_ID`, `QTY`) VALUES ('', '', '$id', '1')";
    
    $result2 = mysql_query($sql2);
    	?>

here's my code for the JS

    function change_sidebar(dElement) {
    	//alert ("oist");
    	var xmlhttp;
    	if (window.XMLHttpRequest)
    	  {// code for IE7+, Firefox, Chrome, Opera, Safari
    	  xmlhttp=new XMLHttpRequest();
    	  }
    	else
    	  {// code for IE6, IE5
    	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    	  }
    	xmlhttp.onreadystatechange=function()
    	  {
    	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    		{
    		document.getElementById("tochange").innerHTML=xmlhttp.responseText;
    		}
    	  }
    	xmlhttp.open("GET","order.php?dValue="+dElement.defaultValue,true);
    	xmlhttp.send();
    }