dimanche 17 mai 2015

If Posted && Which (empty(Posted))

Hi I got a checkbox post and each checkbox has a different value to post , I want to make An if statement to ask which exact ones are posted and if these are the ones posted then //do something Like this:

if(isset($_POST['submit'])){
if(!empty($_POST['value1'] && $_POST['value2'] && $_POST['value3'])) {
//do something
}elseif(!empty($_POST['value1'] && $_POST['value2'])){
 //do something (value 3 must not be posted***!)
}elseif(!empty($_POST['value1'])){
// do something (value 2 and 3 must not be posted***!)  
}
}

Question: The value 2 & 3 could be posted will the if statement refer to the other 2 as well , and whats the better way to make this code?

Aucun commentaire:

Enregistrer un commentaire