$saat=="07:30"
I'm projecting the select an option equal to its value on the screen and the user has to choose an option from here.
There are many more options with else if. I'm just posting the IF part here to ask my question.
How to write select option is required?
<?php if($saat=="07:30") {echo '<strong> <center> <div class="select"> <select name="koltuk" id="koltuk"><option selected="selected">Seçiniz</option> <option value="vagon1">Vagon 1 --> 2 Koltuk Boş</option> <option value="vagon2">Vagon 2 --> 10 Koltuk Boş</option> <option value="vagon3">Vagon 3 --> 5 Koltuk Boş</option> <option value="vagon4">Vagon 4 --> 3 Koltuk Boş</option> <option value="vagon5">Vagon 5 --> 2 Koltuk Boş</option> <option value="vagon6">Vagon 6 --> 2 Koltuk Boş</option> <option value="vagon7">Vagon 7 --> 2 Koltuk Boş</option> <option value="vagon8">Vagon 8 --> 3 Koltuk Boş</option> </select> <div class="select-dropdown"></div> </div><br> </center> </strong>'; }
<select name="koltuk" id="koltuk" required>
as it doesn't.
My Answer:
To make the select option required, you can add the "required" attribute to the select tag. In your code, you can modify the select tag like this:
html
By adding the "required" attribute, the user will be required to select an option from the dropdown before submitting the form.
Rate this post
4 of 5 based on 5679 votesComments