I have a form that have a select input, and there's another pop up that sets a session. i want to save the selected values while the page reloading for the session setting is there's any solution for that ?
example of my code
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<form method="post" action="">
<select name="first">
<option value="example1">first opt</option>
<option value="example2">second opt</option>
</select>
<input type="submit" value="Done">
</form>
<p>you have added > <?php echo $_SESSION['sessionset']; ?></p>
<button data-toggle="modal" data-target="#myModal">Adding something by setting a session</button>
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<form method="post" action="">
<select name="sessionset">
<option value="cupcake">cupcake</option>
<option value="cookie">cookie</option>
</select>
<input type="submit" value="Done">
</form>
</div>
</div>
php
if(isset($_POST['sessionset'])) {
$_SESSION['sessionset'] = $_POST['sessionset'];
}
this is a little example of my page, now i need to set the session and i don't want the user to reset his select because of the reload