I want to show the input field values and selected options after search. Here is my code:
<form action="" method="post">
<input name="number" id="number" type="text" value="<?=$number?>">
<select name="Country_Name" id="Country_Name">
<option value="">Select</option>
<?php
$sql = "SELECT * FROM country WHERE `is_deleted`=0";
$query = mysqli_query($con,$sql);
while($row = mysqli_fetch_array($query)):
?>
<option value="<?=$row['country_value']?>" >
<?=$row['Country_Name']?>
</option>
<?php
endwhile;
?>
</select>
<input type="submit" value="search" name="searchbtn">
</form>
The selected item will comes from database. The name of the table is country. And columns are: country_id, Country_Name, country_value
I have used this for keep the input field value:
$number = (isset($_POST["number"])) ? $_POST["number"] : "";
But this format not working with selected options. How can I do that with php or javascript?