Learn How to Become a Web Developer With PHP-Part 2, In previous post we learned basic concept about web development with php. In this post i’m going to write about Web development with PHP on real example – Student Records. In this application you will learn
- Adding new Student Record
- Display All student Record
Learn Basic Web development : –
Create Database and Tables
Create Database Name student in phpmyadmin . Very easy for beginner to create database and table.
Create Database
Create Table
Create Dashboard
In dashboard Page, we have Add student and Display all student record menu that navigate to particular functionality, so lets start the coding Part.
Index.php
index.php is main panel for our application where user can choose what they want.
<!DOCTYPE html> <html> <head> <title>Student Record | techjunkgigs </title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> </head> <body> <h1 class = "jumbotron text-center"><b><u><a href = "index.php">Student Record</a></u></b></h1> <div class="container-fluid well"> <ul class="nav navbar-nav"> <li><a href="add.php">Add New Student Record</a></li> <li><a href="display.php">Display Student Record</a></li> </ul> </div> </body> </html>
Image for Student record main panel
add.php
add.php file contain all the text box which require to get the student details.
<?php $con = mysqli_connect("localhost","root","","student"); if(isset($_POST['submit'])) { $name = $_POST['name']; $dob = $_POST['dob']; $class = $_POST['class']; $doj = $_POST['doj']; mysqli_query($con,"insert into tbl_student (name,dob,class,doj) values ('$name','$dob','$class','$doj')"); echo "<b>Added successfully</b>"; } ?> <!DOCTYPE html> <html> <head> <title>Student Record | techjunkgigs </title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> </head> <body> <h1 class = "jumbotron text-center"><b><u><a href = "index.php">Student Record</a></u></b></h1> <div class="container-fluid well"> <ul class="nav navbar-nav"> <li class = "active"><a href="add.php">Add New Student Record</a></li> <li><a href="display.php">Display Student Record</a></li> </ul> </div> <div class="container-fluid"> <form method = "POST"> <div class="row"> <div class="col-sm-4"> <label for="Name">Student Name</label> <input type="text" class="form-control" name="name"> </div> <div class="col-sm-4"> <label for="DOB">Date Of Birth</label> <input type="date" class="form-control" name="dob"> </div> <div class="col-sm-4"> <label for="Class">Class</label> <input type="class" class="form-control" name="class"> </div> <div class="col-sm-4"> <label for="DOJ">Date of Joining</label> <input type="date" class="form-control" name="doj"> </div> </div><br/> <div class = "row"> <div class="col-sm-2"> <input type="submit" class="form-control" name = "submit" value = "Submit"> </div> </div> </form> </div> </body> </html>
Image for Add Student Panel
display.php
Display all student record in table from MySQL Database with display.php file.
<?php $con = mysqli_connect("localhost","root","","student"); if(isset($_POST['submit'])) { $name = $_POST['name']; $dob = $_POST['dob']; $class = $_POST['class']; $doj = $_POST['doj']; mysqli_query($con,"insert into tbl_student (name,dob,class,doj) values ('$name','$dob','$class','$doj')"); echo "<b>Added successfully</b>"; } ?> <!DOCTYPE html> <html> <head> <title>Student Record | techjunkgigs </title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> </head> <body> <h1 class = "jumbotron text-center"><b><u><a href = "index.php">Student Record</a></u></b></h1> <div class="container-fluid well"> <ul class="nav navbar-nav"> <li class = "active"><a href="add.php">Add New Student Record</a></li> <li><a href="display.php">Display Student Record</a></li> </ul> </div> <div class="container-fluid"> <table class = "table"> <thead> <tr> <th>Student Name</th> <th>Date Of Birth</th> <th>Class</th> <th>Date Of Joining</th> </tr> </thead> <?php $con = mysqli_connect("localhost","root","","student"); $sql = "select * from tbl_student"; $result= mysqli_query($con,$sql); while($row = mysqli_fetch_array($result)) { ?> <tr> <td><?php echo $row['name']; ?></td> <td><?php echo $row['dob']; ?></td> <td><?php echo $row['class']; ?></td> <td><?php echo $row['doj']; ?></td> </tr> <?php } ?> </table> </div> </body> </html>
Image for Display Student Panel
Download the Project File from Here
[sociallocker]Student Record[/sociallocker]
Note : – Knowing and developing the application is your greatest skill and capability but for landing a good job, you have to prepare for interview. So here Toptal is providing the Key PHP Concepts and Paradigms. Go and check out, it help you a lot.
I hope this tutorial helped you to learn how to create PHP application with MySQL. To get the latest news and updates follow us on twitter & facebook, subscribe to our YouTube channel. And If you have any query then please let us know by using comment form.
CraftDecode says
Very Useful Information. Thanks For the post and keep posting.
nonsensestuff says
amazing thanks for sharing with us
Jamaley Hussain says
I’m glad that you like it.
Thank you for stopping and commenting here.
This site is very dear. I visit every day. The site is not found anymore. We’ve got Google search
Hi, Lima
Thanks for visiting and commenting here.
wow nice article
Hi Gurteg,
Thanks for stopping and commenting here
Keep visiting.
Thanks for the information its really good
Hi Vamsi,
I’m glad to know that you like it. thanks for stopping here.
Keep visiting.
Good strategy for seo. I will use these tactics in my blog. Very informative. Keep it up and spreading good things. Thanks a lot
Hi Amit,
Good to hear that you like the post. Thanks for commenting and visiting here.