Pregunta

I have a form and fields are name, surname and email. When I filled name but did not fill surname and email fields I want to name area write name area.(I did not write all codes.) I hope u can find where is my mistake.

<?php 
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = htmlspecialchars(trim($_POST["name"]));
}
?>

<form method="post" action="">
<label for="name">Name<br>
<input type="text" name="name" id="name" placeholder="Your Name" autocomplete="off" value="<?php if (isset($name)) echo $name; ?>"> <br>
</label>
</form>

Thank you guys..!

¿Fue útil?

Solución

You haven't added an "=" to your value

value="<?php if (isset($name)) echo $name; ?>"

That should fix it :)

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top