Below is the code that I am currently using:
$form = "
<form action='echo htmlentities($_SERVER["PHP_SELF"]);' method='post'>
<table>
<tr>
<td>Username</td>
</td><input type='text' name='user' value='$getuser' /></td>
</tr>
</table>
</form>";
?>
The above code is giving me this error:
Parse error: syntax error, unexpected '"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in ... on line 27
If I change this: ["PHP_SELF"] to this ['PHP_SELF'], then I recieve this error:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in ... on line 27
How can I fix the form action above so that it stops returning with parse errors?
Change:
to
You’re already in PHP and building a string so there’s no need for the echo within the string.