PHP - Simple Easter Date Getter
Submitted by razormist on Sunday, February 3, 2019 - 08:21.
In this tutorial we will create a Simple Easter Date Getter using PHP. PHP is a server-side scripting language designed primarily for web development. Using PHP, you can let your user directly interact with the script and easily to learned its syntax. It is mostly used by a newly coders for its user friendly environment. So Let's do the coding...
There you have it we successfully created Simple Easter Date Getter using PHP. I hope that this simple tutorial help you to what you are looking for. For more updates and tutorials just kindly visit this site. Enjoy Coding!
Getting started:
First you have to download & install XAMPP or any local server that run PHP scripts. Here's the link for XAMPP server https://www.apachefriends.org/index.html. Lastly, this is the link for the bootstrap that i used for the layout design https://getbootstrap.com/.Creating The Interface
This is where we will create a simple form for our application. To create the forms simply copy and write it into you text editor, then save it as index.php.- <!DOCTYPE html>
- <?php
- ?>
- <html lang="en">
- <head>
- <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1"/>
- <link rel="stylesheet" type="text/css" href="css/bootstrap.css"/>
- </head>
- <body>
- <nav class="navbar navbar-default">
- <div class="container-fluid">
- <a class="navbar-brand" href="https://sourcecodester.com">Sourcecodester</a>
- </div>
- </nav>
- <div class="col-md-3"></div>
- <div class="col-md-6 well">
- <h3 class="text-primary">PHP - Simple Easter Date Getter</h3>
- <hr style="border-top:1px dotted #ccc;"/>
- <div class="col-md-3"></div>
- <div class="col-md-6">
- <form method="POST">
- <div class="form-group">
- <select name="year" class="form-control" required="required">
- <option value="">Select an option</option>
- <?php
- for($i = $y; $i >= 1965; $i--){
- echo "<option value='".$i."'>".$i."</option>";
- }
- ?>
- </select>
- </div>
- <?php include 'get_easter.php'?>
- <center><button class="btn btn-primary" name="get">Get Easter Date</button></center>
- </form>
- </div>
- </div>
- </body>
- </html>
Creating the Main Function
This code contains the main function of the application. This code will calculate the actual date of the easter day. To do this just copy and write the code inside the text editor, then save it as get_easter.php.- <?php
- $year = $_POST['year'];
- echo "<center><h3 class='text-primary'>".$date."</h3></center>";
- }
- ?>
Add new comment
- 32 views