I'm supposed to make a simple order calculator using a loop. I need to have a web page which asks a user what they want to order, when they type in the name of the product and the quantity, the web page will look up and calculate the price. The page then asks them if they want to order more and if they click okay, another box comes up again asking them what they want to order and how much they want. The whole time, a running total is supposed to be kept so that when they finally click that they do not want to order anymore, the program terminates and shows them their total.

This is the code I have so far:

PHP Code:
var nameproductquantityconfirmtotalpricediscount;
    
    var 
name prompt("Welcome to Ice Cream Shop. What is your name?""Enter name");
    var 
sentence "Hello " name " please look through our available products and services before placing your order.";
    
alert(sentence);
     
    var 
total 0
    var 
price 0;
    var 
discount 0;
    
    do 
    {
    var 
product prompt("What would you like to order?","");
    var 
quantity prompt ("What would you like to order?","");
    
total total price;
    var 
confirm = continue("Do you want to order anything else?");
    }
    
    while (
confirm==true);
    
    if(
product === "ice cream cake") {
                    
price 20 discount;
                    
discount = (.15 price);
            } else if (
product === "ice cream cone") {
                    
price discount;
                    
discount = (.01 price);
            } else if (
product === "small ice cream sundae") {
                    
price discount;
                    
discount = (.05 price);
            } else if (
product === "large ice cream sundae") {
                    
price discount;
                    
discount = (.05 price);
            } else 
alert("Sorry, " name ". You entered an invalid product. Refresh the page to reload and place the order again.");
            }
    else 
    {
            
alert("Refresh the page to reload and place a new order");
    }
        
    if (
product == "ice cream cake" || product == "ice cream cone" || product == "small ice cream sundae" || product == "large ice cream sundae") {
    
    
document.write("Thank you for placing an order with us, " name ".");
    
document.write("</br>");
    
document.write("With the discount, your total order cost is " total ".");
    
    }
    else
    {
    
    
document.write("Refresh the page to reload and place a new order");
    
    } 
Any help would be appreciated because I am unbelievably confused.