誰かが、フォームをチェックするより洗練された方法を提案することができますか?例えば、QA1が2に設定されている場合はQA1Cに値を設定し、QA1Cに値を設定しない場合はエラーを追加するなど、他のタイプのチェックが必要な場合もあります。フォームをチェックするエラーのエレガントな方法をお探しですか?
if (empty($_POST['QA1'])) {$errorMessage .= "<h1>QA1 not specified</h1>";}
if (empty($_POST['QA2'])) {$errorMessage .= "<h1>QA2 not specified</h1>";}
if (empty($_POST['QA3'])) {$errorMessage .= "<h1>QA3 not specified</h1>";}
if (empty($_POST['QB1'])) {$errorMessage .= "<h1>QB1 not specified</h1>";}
if (empty($_POST['QB2'])) {$errorMessage .= "<h1>QB2 not specified</h1>";}
if (empty($_POST['QB3'])) {$errorMessage .= "<h1>QB3 not specified</h1>";}
if (empty($_POST['QB4'])) {$errorMessage .= "<h1>QB4 not specified</h1>";}
if (empty($_POST['QB5'])) {$errorMessage .= "<h1>QB5 not specified</h1>";}
if (empty($_POST['QB6'])) {$errorMessage .= "<h1>QB6 not specified</h1>";}
if (empty($_POST['QB7'])) {$errorMessage .= "<h1>QB7 not specified</h1>";}
if (empty($_POST['QB8'])) {$errorMessage .= "<h1>QB8 not specified</h1>";}
if (empty($_POST['QB9'])) {$errorMessage .= "<h1>QB9 not specified</h1>";}
if (empty($_POST['QC1'])) {$errorMessage .= "<h1>QC1 not specified</h1>";}
if (empty($_POST['QD1'])) {$errorMessage .= "<h1>QD1 not specified</h1>";}
if (empty($_POST['QD2'])) {$errorMessage .= "<h1>QD2 not specified</h1>";}
if (empty($_POST['QD3'])) {$errorMessage .= "<h1>QD3 not specified</h1>";}
if (empty($_POST['QE1'])) {$errorMessage .= "<h1>QE1 not specified</h1>";}
if (empty($_POST['QE2'])) {$errorMessage .= "<h1>QE2 not specified</h1>";}
if (empty($_POST['QF1'])) {$errorMessage .= "<h1>QF1 not specified</h1>";}
if (empty($_POST['QF2'])) {$errorMessage .= "<h1>QF2 not specified</h1>";}
if (empty($_POST['QF3'])) {$errorMessage .= "<h1>QF3 not specified</h1>";}
if (empty($_POST['QF4'])) {$errorMessage .= "<h1>QF4 not specified</h1>";}
if (empty($_POST['QF5'])) {$errorMessage .= "<h1>QF5 not specified</h1>";}
if (empty($_POST['QG1'])) {$errorMessage .= "<h1>QG1 not specified</h1>";}
if (empty($_POST['QG2'])) {$errorMessage .= "<h1>QG2 not specified</h1>";}
if (empty($_POST['QG3'])) {$errorMessage .= "<h1>QG3 not specified</h1>";}
if (empty($_POST['QG4'])) {$errorMessage .= "<h1>QG4 not specified</h1>";}
if (empty($_POST['QH1'])) {$errorMessage .= "<h1>QH1 not specified</h1>";}
if (empty($_POST['QI1'])) {$errorMessage .= "<h1>QI1 not specified</h1>";}
if (empty($_POST['QI2'])) {$errorMessage .= "<h1>QI2 not specified</h1>";}
if (empty($_POST['QJ1'])) {$errorMessage .= "<h1>QJ1 not specified</h1>";}
if (empty($_POST['QJ2'])) {$errorMessage .= "<h1>QJ2 not specified</h1>";}
if (empty($_POST['QJ3'])) {$errorMessage .= "<h1>QJ3 not specified</h1>";}
配列を使用してループします。 [HTMLフォームで配列を作成するにはどうすればいいですか?](http://php.net/manual/en/faq.html.php#faq.html.arrays) –