-1

I'm trying to make a simple php calculator which multiplies quantity to predefined prices. Here is my code but I got error 500. I can't manage to fix it by myself. It's html form with $_post checks and $_post submit button

// Check if form was submitted
$product = $_POST['product']; 
$quantity = $_POST['quantity'];
$first = 0,6;
$second = 0,5;
$third = 2,8;
if ( isset($_POST['submit']) ) {
    switch($_POST['product']) {
        case '1':
            $calculation = $quantity * $first;
            echo "Цена" . $calculation;
        break;
        case '2':
            $calculation = $quantity * $second;
            echo "Цена" . $calculation;
        break;
        case '3':
            $calculation = $quantity * $third;
            echo "Цена" . $calculation;
        break;
        default:
    }
}
?>
<form action="" method="post">
    <select name="product" id="product">
        <option>Choose servicve</option>
        <option value="1">Service 1</option>
        <option value="2">Service 2</option>
        <option value="3">Service 3</option>
    </select>
    <br>
    <input type="number" name="quantity" id="quantity">
    <br>
    <input type="submit" name="submit" value="submit">
</form><br /> ```
Buzdrev
  • 3
  • 4
  • 2
    Does this answer your question? [How can I make PHP display the error instead of giving me 500 Internal Server Error](https://stackoverflow.com/questions/2687730/how-can-i-make-php-display-the-error-instead-of-giving-me-500-internal-server-er) – catcon Dec 23 '19 at 23:24

1 Answers1

0

Just simple mistake for simple calculator, you printed "," instead of point(".")

$first = 0,6;
$second = 0,5;
$third = 2,8;
Dmitry Reutov
  • 2,995
  • 1
  • 5
  • 20