-2

Ok so i'm trying to make a checklist for a school website and I want to make an ordered list followed by the check box and the description. Here is my code for it but I get an error message saying "Unexpected IF statement."

echo "<ol type='1'>
       <li>" . if ($r['check1'] == 1){
           echo "<input type='checkbox' name='check1' value='1' checked>submitted my JSCC
                  admissions application for the upcoming term to JSCC Admissions and Records
                  Services.
                  \n<br>";
       } else {
           echo "<input type='checkbox' name='check1' value='1'>submitted my JSCC admissions
                  application for the upcoming term to JSCC Admissions and Records
                  Services.
                  \n<br>";} . "</li>

       </ol>\n";
  • 1
    PHP and HTML are independent, there are no limitations to what and where you output HTML with PHP. The problem is you can't use if in an expression. – Devon Bessemer May 04 '17 at 16:41
  • right and as expected. Use the condition to check if it's equal to something, then echo, and vice-versa. – Funk Forty Niner May 04 '17 at 16:43
  • @Fred -ii- I knew the IF statement worked because I used it elsewhere in my program with no problems, my only issue was how to put it inside a
  • tag.
  • – Aric Sprague May 04 '17 at 17:04