If you are the student of the BTech, BCA or MCA you must aware of the fact that we all have to build a project in our last semesters but after searching the net and going through various site we don’t have the full explanation to “How to build a Project using a particular language”. So here we are to help you by explaining each and every step to create your own project with no one’s help but yours.
Xampp, Phpmyadmin, htdocs
Starting with the PHP language by explaining each and every step going further we have,
Step 1: Install a server like XAMPP or WAMP. Download the xampp for apache server and install it as per your requirement.
Step 2: in xampp you should look into htdocs and you can create a New Folder for the collection of the code you will be creating [optional].
Step 3: start apache server by click on the control panel of xampp. if port 80 is free, no issue otherwise unblock it using these links
In XAMPP panel START the MYSQL module.
Step 4: To start or see the DBMS which is on MySQL go the URL and type localhost/phpmyadmin
Step 5: Create a new Database, or create a table, insert a record into just click and view. no need of code, however for every action, a code snippet can be seen by you. for local server or web server To access the database we must need the Username and the Password. by default username root and password is blank.
<html> <title> My first Page</title> Hello what's your name <form action="#" method="post"> <input type="text" name="val"> <input type="submit"> </form> <?php if(!empty($_POST['val'])) echo $_POST['val']; else echo "write something"; ?> </html>
After having the rough idea of how the first program of PHP looks like let’s move onto the exact program which works and give some reasonable output. The code is as follows:
<html> <head> <title>First Form for project </title> </head> <body> <h1>Form</h1> <h2>Form</h2> <p>Hi this first paragraph <br/> Ok new line. <br/> after the line <a href="https://coderinme.com" target="_blank"><img src="l-2.png" Title="Click here"></a> </p> <form action="#" method="post"> <input type="text" name="val"> <input type="number" name="val1"> <input type="date" name="val2"> <input type="checkbox" name="val3">hhh <input type="radio" name="val">male <select name=""> <option value="Saif">Saif</option> <option value="Neha">Neha</option> <option value="Daud">daud</option> </select> <input type="submit"> </form> </body> <?php if(!empty($_GET['id'])) echo $_GET['id']; else echo 'get value not present'; if(!empty($_POST['val1'])) echo "<br/> ".$_POST['val1']; else echo "<br/>write value in 2nd field"; ?> </html>
As we have seen that in the very first program we just learn to print something.Now I this code we begin as:
- First simply give the title in the ‘title’ tag then in the body giving the heading Phrase to print the heading with all the format of Heading 1 and 2.
- After that starting the new paragraph with <p> following with the break tag </br> to break the line from that point.
- In the third category, explaining how to go on the particular page by giving the URL of that page as <a href = “https://coderinme.com” target= “blank”>.
- To show any image we have to use <img src> by defining the name and giving the title of the image like <img src=”l-2.png” Title=”Click here”>.
- Next creating a form with different input tags i.e. tags to input the data with different data types like
<form action=”#” method=”post”>
<input type=”text” name=”val”>
<input type=”number” name=”val1″>
<input type=”date” name=”val2″>
<input type=”checkbox” name=”val3″>hhh
<input type=”radio” name=”val”>male
In this we define text, number, date, checkbox and radio button providing values of checkbox and radio button.
- Then declaring the drop down values in <select> tag and giving the option in <option value> in
- Starting the php code in <?php> tag we are having the name which we entered in url in GET as if(!empty($_GET[‘id’])) if we write id after url like https//coderinme.com/?id=coderinme then this id will get by GET.
- In the next POST, the input tag value of the HTML code will get as in above code we are inputting the Name in tag thus it will get by the POST tag as in
- The difference between the GET and the POST is that GET is not safe as we can see this in URL but POST is safe as we don’t find it in the URL it will be fetched through the code.
This is all the explanation of the two youtube videos of CoerInMe channel. In the next post we’ll explain about the next video.
To watch Youtube videos go to:
All rights reserved. No part of this Post may be copied, distributed, or transmitted in any form or by any means, without the prior written permission of the website admin, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the owner, addressed “Attention: Permissions Coordinator,” to the admin @coderinme