Creating A Simple Date of Birth Dropdown Menu Using PHP/HTML
Submitted by razormist on Monday, December 19, 2016 - 17:22.
In this tutorial, we'll create a simple date of birth dropdown menu. The PHP for loop handles the loop-related statement (Initialize, Conditional, Increment or Decrement)
For Month:
Syntax
The following syntax display the select element for month
Output
For Day: Syntax The following syntax display the select element for day
Output
For Year: Syntax The following syntax display the select element for year Output I hope that this tutorial help you to your project and future projects. Enjoy Coding!!!
- <select name = "month">
- <option>Month</option>
- <?php
- for($month = 1; $month <= 12; $month++)
- echo"<option value = '".$month."'>".$month."</option>";
- ?>
- </select>
For Day: Syntax The following syntax display the select element for day
- <select name = "day">
- <option>Day</option>
- <?php
- for($day = 1; $day <= 31; $day++){
- echo "<option value = '".$day."'>".$day."</option>";
- }
- ?>
- </select>
For Year: Syntax The following syntax display the select element for year Output I hope that this tutorial help you to your project and future projects. Enjoy Coding!!!
Comments
Add new comment
- Add new comment
- 5794 views