php if statement html option value

后端 未结 4 926
粉色の甜心
粉色の甜心 2021-02-06 14:49

Suppose you have the following html select statement






Then

if ($_POST['demo'] === 'Newest') {
// Run this
}
elseif ( $_POST['demo'] === 'Best Sellers' ) {
// Run this
}

or

switch($_POST['demo']){
    case 'Newest' : 
        //some code;
        break;
    case 'Best Sellers':
        //some code;
        break;
    default:
        //some code if the post doesn't match anything
}

提交回复
热议问题