jeudi 21 mars 2019

How to fix this if-else statement in PHP [duplicate]

This question already has an answer here:

I have a form that allows me to choose the size as M or L, I want to echo "20" if the size is M and "25" if the size is L, I have this code but not matter what option choose it only echo the 20:

    $m_price=20;
    $l_price=25;
    if ($_POST['Size']='M'){
    $size_price= $m_price;
    echo $size_price;}
    elseif ($_POST['Size']='L'){
    $size_price= $l_price;
    echo $size_price;}

Aucun commentaire:

Enregistrer un commentaire