I try to create a form with text field i want to keep the value after submit
for that i do this
<input id="datepicker" name="txt_date" type="text" placeholder="Date" class="form-control input-md" value="<?php echo isset($_POST['txt_date']) ? $_POST['txt_date'] : ''?>">
<?php
$sql=mysqli_query($conn,"select DISTINCT db_name,db_user from tbl_staff {$query} order by db_name asc ")or die(mysqli_error($conn));
echo "<select name='txt_name' class='states'>";
echo "<option value='";?><?php echo isset($_POST['txt_name']) ? $_POST['txt_name'] : ''?><?php echo"'></option>";
while($res=mysqli_fetch_array($sql)){
$userid=$res['db_user'];
$name=$res['db_name'];
if($name!=""){
echo "<option value='$userid'>$name</option>";
}} echo "</select>";?>
this code work for the textbox but it didn't work for the select one
when i choose a date and a name from the select menu and do submit only the value in text box stay but on select menu didn't stay
and i have two button one to submit the form and the other to clear the form from the values but also the button clear didn't work
<input type="submit" name="submit" value="Search" class="btn btn-default">
<input type="reset" name="clear" value="Clear" class="btn btn-default">
How can i solve this two problems ??!