Trying to put some slightly tricky form validation (in this instance for checkboxes) in relation to a sign up form for a tennis tournament
<?php
if ( ( isset($_POST['ms'])&&isset($_POST['ws']) )
|| (isset($_POST['mc'])&&isset($_POST['ws']))
|| (isset($_POST['md'])&&isset($_POST['ws']))
|| (isset($_POST['ms'])&&isset($_POST['wc']))
|| (isset($_POST['ms'])&&isset($_POST['wd']))
|| (isset($_POST['mc'])&&isset($_POST['wc']))
|| (isset($_POST['mc'])&&isset($_POST['wd']))
|| (isset($_POST['md'])&&isset($_POST['wd']))
){
$error_message .=('You can only play as one sex! <br />');
}
if ( (isset($_POST['mc'])&&isset($_POST['md']) ) { //***
$error_message .=('You cannot play in both the cadet tournament and mens doubles <br />');
}
However, this causes a parse error for the line with the three asterisks.
unexpected ‘{‘
Presumably I have done something wrong, not in the use of curly brackets, but rather round brackets… but I cannot see where..
You’re missing a closing-bracket in your second
ifstatement, use:In future I’d suggest counting your opening and closing brackets in complex statements to make sure they’re balanced.