I have been tasked with creating a PHP quiz and have ran into some error when trying to make it a SPA (Single Page Application). The known way I've been shown to do this is by wrapping your HTML code within an echo" " function but when doing so i get a parse error for one line that tries to loop back on itself to produce a results section i have once the submit button is pressed on the page after all questions is answered.
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /opt/lampp/htdocs/SPA/index.php on line 186
Note i have this function working when ran as an individual separate page but no luck when trying to turn that page into a function within my index.php to turn it all into one SPA (As that's my end goal)
Line producing the error above:
<form name="inputForm" id="inputForm" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" onsubmit="return validateForm()">
Submit button which checks the answers
if(isset($_POST["submit"])){
checkAnswers();
}
My output should be the results from my quiz but my current output is the error noted above.