-1

So I am getting the following parse error when this file loads:

Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), 
expecting identifier (T_STRING) or variable (T_VARIABLE) or number 
(T_NUM_STRING)

I have tried everything to work out why and I narrowed it down to the

href=\"start.php?id=<?php echo $res['id'] ?>\"

section of the code. I am sure I left out a ' or " but unsure where as it all makes sense to me. Can anyone with a keener eye see where I am going wrong? Thank you.

My code:

<td>

<?php if($res['ndaSent'] == "No") {
echo "<span class=\"buttonTestDisabled\"> Start Test</span>";} 
else {
echo "<a class=\"buttonTest\" href=\"start.php?id=<?php echo $res['id'] 
?>\">Start Test</a> ";}
?>

</td>
Antistandard
  • 73
  • 1
  • 7

1 Answers1

0

Take a look at that. You can't use echo command inside of an echo " " line. Try using ' inside and not \ may help you too from confusion.

<?php if($res['ndaSent'] == "No") {
echo "<span class='buttonTestDisabled'> Start Test</span>";

}else{

echo "<a class='buttonTest' href='start.php?id=".$res['id'].">Start Test</a>';}
?>

</td>
clearshot66
  • 2,292
  • 1
  • 8
  • 17