Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Keep values in search form after submit

<?php

// if data 'search' posted in POST method, make it safe in HTML then store it in $search. If 'search' data was not posted, fill it with an empty string ('')
$search = (isset($_POST['search'])) ? htmlentities($_POST['search']) : '';

?>

<form action="this_page.php" method="post">
    <input type="text" name="search" placeholder="Search..." value="<?= $search ?>">
    <input type="submit" value="Go">
</form>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Keep #values #search #form #submit
ADD COMMENT
Topic
Name
2+8 =