antoinv10 antoinv10 - 1 year ago 42
PHP Question

Put php value in html field after query has been executed

I'd like to put a value in my text boxes that I get from a php query, but when I do it the values I want to put in my text boxes are not set. Does anyone know how I could do this ?
Here is my code :

Nom : <input type="text" name="nom" value="<?php if(isset($nom)){echo htmlspecialchars($nom);} ?>"/>


Answer Source

Try this one:

    $nom = $_POST['nom'];
    if (isset($nom)){ 
        $new = htmlspecialchars($nom);

    <input type="text" name="nom" value="<?php echo $new; ?>" />