html - How to not clear input fields in php form? -
i have webpage uses php , has bunch of input fields in user enters data , turn input sql statement query database. parse input fields , put sql statement when click "submit" button, input fields cleared. how can make these input fields don't erase every time user clicks "submit"?
store them in local variables
<?php $name = ''; $last = ''; if(isset($_post['post_me'])) { $name = $_post['post_me']; $last = $_post['last']; //process further } ?> <form method="post"> <input type="text" name="name" value="<?php echo $name; ?>" /> <input type="text" name="last" value="<?php echo $last; ?>" /> <input type="submit" name="post_me" /> </form>
Comments
Post a Comment