Normally I'm using a code like this for forms. The PHP code in it is to refill the form, e.g. if something is missing or so:
<form action="" method="post">
<input type="text" name="first_name" <?php if (isset($_POST['first_name'])) { echo "value=\"".$_POST['first_name']."\"";} ?>><br>
<input type="text" name="last_name" <?php if (isset($_POST['last_name'])) { echo "value=\"".$_POST['last_name']."\"";} ?>><br>
<input type="submit" name="submit">
</form>
A security tool just told me a hacker could manipulate my code if filling e.g. "><p>Hello!!!</p>
and then submit. Could a hacker also manipulate PHP code or only HTML?
Is this a big secure issue?
What's the best way to prevent this? Is it enough to just search an remove special characters like >
and "
? Or is there a better, more elegant way?