Fullstack - Webdevelopment - Intership - Report - 15 Days
Fullstack - Webdevelopment - Intership - Report - 15 Days
PHP is a server side scripting language designed for web development but also used
aux general purpose programming language PHP is now installed on more than 244
million websites and 2.1 million web servers Originally created by Rasmus Lerdorf in
1995 the reference implementation of PHP now produced by the PHP Group. While
PHP originally stood for Personal Home Page it now stands for PHP Hypertext Pre-
processor, a recursive acronym. PHP code is interpreted by a web server with a PHP
processor module, which generates the resulting web page: PHP commands can be
embedded directly into an HTML, source document rather than calling an external file
to process data. It has also evolved to include a command line interface capability and
can be used in standalone graphical applications PHP is free software released under
the PHP License, which is incompatible with the GNU General Public License
(GPL) due to restrictions on the usage of the term PHP can be deployed on must web
servers and also as a standalone shelf on almost every operating system and platform
five of charge PHP is an acronym for "PHP Hypertext Pre-processor PHP is a widely
used open source scripting language PHP scripts are executed on the server PHP costs
nothing, it is free to download and use.
PHP is a scripting language it gets interpreted instead of being compiled like C++ and
Java Unlike JavaScript which is executed by the web browser, all PHP code is
executed on the web server. The syntax is very similar to Perl and C .Variables are
case sensitive, function names are not, and statements must be terminated with a
semicolon. PHP code should be placed between< ?Code?>or<? Php code? > tags. The
second method is preferred so your scripts are XML compatible. There is no
limitation as to where PHP code can be inserted. To see information about how PHP
is configured, version information, and the settings of all environment variables (eg
HTTP_USER_AGENT and QUERY_STRING), call the phpInfo () function in any
script. The php.ini file is the main configuration file for PHP. It can be edited by the
system administrator to change any of the configuration settings. A change to this file
requires the web server be restarted since the file is only read once when the web
server starts up.
DAY 1
HTML
Introduction to HTML
What is HTML?
HTML stands for Hyper Text Markup Language
HTML is the standard markup language for Web pages
HTML elements are the building blocks of HTML pages
Structure of HTML Document
Start with <!DOCTYPE html>
Begin with <html> and end with </html>
Visible part between <body> and </body>
The header part between <head> and </head> which includes Styles and Scripts
<!DOCTYPE html><html>
<head>
<title>HTML Formatting Tags</title>
</head>
<body>
<h2>HTML Formatting Tags</h2>
This is <b>Bold text</b>...<br>
This is Log<sub>5</sub>10...<br>
This is x<sup>2</sup>...<br>
10<sup>X</sup>
</body>
</html>
DAY 2
HTML List
HTML lists allow web developers to group a set of related items in lists.
Unordered HTML List
o An unordered list starts with the <ul> tag. Each list item starts with the <li> tag.
o The list items will be marked with bullets (small black circles) by default:
Ordered HTML List
o An ordered list starts with the <ol> tag. Each list item starts with the <li> tag.
o The list items will be marked with numbers by default:
HTML Image Size - Width and Height
Example Code
<!DOCTYPE html>
<html>
<head>
<title>Hello World</title>
</head>
<body>
<h1>Image</h1>
<img src="image/photo1.png" alt="Photo 1" width="200px" height="150px">
</body>
</html>
Output:
HTML Tables
HTML tables allow web developers to arrange data into rows and columns.
A table in HTML consists of table cells inside rows and columns
HTML Links
Links are found in nearly all web pages. Links allow users to click their way from
page to page.
HTML links are hyperlinks.
o You can click on a link and jump to another document.
o When you move the mouse over a link, the mouse arrow will turn into a little hand.
DAY 3
HTML Forms
An HTML form is used to collect user input. The user input is most often sent to a
server for processing.
The <form> Element
The HTML <form> element is used to create an HTML form for user input:
The <input> Element
The HTML <input> element is the most used form element.
An <input> element can be displayed in many ways, depending on the type
attribute.
DAY 4
BOOTSTRAP
Introduction
Get started with Bootstrap, the world’s most popular framework for building
responsive, mobile-first sites, with Bootstrap CDN and a template starter page.
Bootstrap is developed mobile first, a strategy in which we optimize code for mobile
devices first and then scale up components as necessary using CSS media queries. To ensure
proper rendering and touch zooming for all devices, add the responsive viewport meta tag to
your <head>.
Layout
Containers
Containers are the most basic layout element in Bootstrap and are required when
using our default grid system. Choose from a responsive, fixed-width container (meaning its
max-width changes at each breakpoint) or fluid-width (meaning it’s 100% wide all the time).
Grid system
Use our powerful mobile-first flexbox grid to build layouts of all shapes and sizes
thanks to a twelve column system, five default responsive tiers, Sass variables and mixins,
and dozens of predefined classes.
Bootstrap’s grid system uses a series of containers, rows, and columns to layout and
align content. It’s built with flexbox and is fully responsive.
Grid options
While Bootstrap uses ems or rems for defining most sizes, pxs are used for grid breakpoints
and container widths. This is because the viewport width is in pixels and does not change
with the font size.
Typography
Headings
All HTML headings, <h1> through <h6>, are available.
.h1 through .h6 classes are also available, for when you want to match the font styling of a
heading but cannot use the associated HTML element.
Images
Documentation and examples for opting images into responsive behavior (so they
never become larger than their parent elements) and add lightweight styles to them—all via
classes.
Table
Using the most basic table markup, here’s how .table-based tables look in Bootstrap.
All table styles are inherited in Bootstrap 4, meaning any nested tables will be styled in the
same manner as the parent.
Alerts
Provide contextual feedback messages for typical user actions with the handful of
available and flexible alert messages.
<div class="alert alert-primary" role="alert">
A simple primary alert—check it out!
</div>
<div class="alert alert-secondary" role="alert">
A simple secondary alert—check it out!
</div>
<div class="alert alert-success" role="alert">
A simple success alert—check it out!
</div>
<div class="alert alert-danger" role="alert">
A simple danger alert—check it out!
</div>
<div class="alert alert-warning" role="alert">
A simple warning alert—check it out!
</div>
<div class="alert alert-info" role="alert">
A simple info alert—check it out!
</div>
<div class="alert alert-light" role="alert">
A simple light alert—check it out!
</div>
<div class="alert alert-dark" role="alert">
A simple dark alert—check it out!
</div>
Documentation and examples for badges, our small count and labeling component.
Badges scale to match the size of the immediate parent element by using relative font sizing
and em units
Butt
ons
Use Bootstrap’s custom button styles for actions in forms, dialogs, and more with
support for multiple sizes, states, and more.
Bootstrap includes several predefined button styles, each serving its own semantic
purpose, with a few extras thrown in for more control.
Cards
Bootstrap’s cards provide a flexible and extensible content container with multiple
variants and options.
Carousels
Carousels don’t automatically normalize slide dimensions. As such, you may need to
use additional utilities or custom styles to appropriately size content. While carousels support
previous/next controls and indicators, they’re not explicitly required. Add and customize as
you see fit.
The .active class needs to be added to one of the slides otherwise the carousel will not
be visible. Also be sure to set a unique id on the .carousel for optional controls, especially if
you’re using multiple carousels on a single page. Control and indicator elements must have a
data-target attribute (or href for links) that matches the id of the .carousel element.
DAY 5
Forms
Examples and usage guidelines for form control styles, layout options, and custom
components for creating a wide variety of forms. Bootstrap’s form controls expand on our
Rebooted form styles with classes. Use these classes to opt into their customized displays for
a more consistent rendering across browsers and devices.
Be sure to use an appropriate type attribute on all inputs (e.g., email for email address
or number for numerical information) to take advantage of newer input controls like email
verification, number selection, and more.
Here’s a quick example to demonstrate Bootstrap’s form styles. Keep reading for
documentation on required classes, form layout, and more.
<form>
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" id="exampleInputEmail1" aria-
describedby="emailHelp">
<small id="emailHelp" class="form-text text-muted">We'll never share your email
with anyone else.</small>
</div>
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control" id="exampleInputPassword1">
</div>
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" id="exampleCheck1">
<label class="form-check-label" for="exampleCheck1">Check me out</label>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
DAY 6
Navbar
Documentation and examples for Bootstrap’s powerful, responsive navigation header,
the navbar. Includes support for branding, navigation, collapse plugin, and more.
How it works
Here’s what you need to know before getting started with the navbar:
Navbars require a wrapping .navbar with .navbar-expand{-sm|-md|-lg|-xl} for
responsive collapsing and color scheme classes.
Navbars and their contents are fluid by default. Use optional containers to limit their
horizontal width.
Use our spacing and flex utility classes for controlling spacing and alignment within
navbars.
Navbars are responsive by default, but you can easily modify them to change that.
Responsive behavior depends on our Collapse JavaScript plugin.
Navbars are hidden by default when printing. Force them to be printed by adding .d-
print to the .navbar. See the display utility class.
Ensure accessibility by using a <nav> element or, if using a more generic element
such as a <div>, add a role="navigation" to every navbar to explicitly identify it as a
landmark region for users of assistive technologies.
DAY 7
PHP
Introduction to PHP
PHP is a server side scripting language, and a powerful tool for making dynamic and
interactive Web pages.
PHP code is executed on the server.
PHP case sensitive.
What is PHP
PHP stands for "PHP: Hypertext Preprocessor"
PHP is a widely-used, open source scripting language
PHP scripts are executed on the server
PHP is free to download and use
PHP files can contain text, HTML, CSS, JavaScript, and PHP code
PHP code is executed on the server, and the result is returned to the browser as plain
HTML
PHP files have extension ".php
PHP Syntax
<!DOCTYPE html>
<html>
<body>
<h1>My first PHP page</h1>
<?php
echo "Hello World!";
?>
</body>
</html>
Comments in PHP
A comment in PHP code is a line that is not executed as a part of the program. Its only
purpose is to be read by someone who is looking at the code.
PHP Variables
A variable can have a short name (like x and y) or a more descriptive name (age, carname,
total_volume).
Rules for PHP variables:
A variable starts with the $ sign, followed by the name of the variable
A variable name must start with a letter or the underscore character
A variable name cannot start with a number
A variable name can only contain alpha-numeric characters and underscores (A-z, 0-
9, and _ )
Variable names are case-sensitive ($age and $AGE are two different variables)
PHP Datatypes
Variables can store data of different types, and different data types can do different
things.
PHP supports the following data types:
String
Integer
Float (floating point numbers - also called double)
Boolean
Array
Object
NULL
PHP String
o strlen() - Return the Length of a String
o str_word_count() - Count Words in a String
o strrev() - Reverse a String
o strpos() - Search For a Text Within a String
o str_replace() - Replace Text Within a String
o str_replace() - Replace Text Within a String
o PHP explode() Function
o PHP str_ireplace() Function
o PHP md5() Function
o PHP strcmp() and strcasecmp() Function
o PHP trim() Function
PHP Loops
In PHP, we have the following loop types:
while - loops through a block of code as long as the specified condition is true
do...while - loops through a block of code once, and then repeats the loop as long as
the specified condition is true
for - loops through a block of code a specified number of times
foreach - loops through a block of code for each element in an array
PHP Operators
Operators are used to perform operations on variables and values. PHP divides the operators
in the following groups:
Arithmetic operators
Assignment operators
Comparison operators
Increment/Decrement operators
Logical operators
String operators
Array operators
PHP Arrays
An array stores multiple values in one single variable:
Create an Array in PHP
In PHP, the array() function is used to create an array:
In PHP, there are three types of arrays:
Indexed arrays - Arrays with a numeric index
Associative arrays - Arrays with named keys
Multidimensional arrays - Arrays containing one or more arrays
<?php
$cars = array("Volvo", "BMW", "Toyota");
echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] . ".";
?>
PHP Indexed Arrays
There are two ways to create indexed arrays:
$cars = array("Volvo", "BMW", "Toyota");
The index can be assigned automatically (index always starts at 0), like this:
$cars[0] = "Volvo";
$cars[1] = "BMW";
$cars[2] = "Toyota";
PHP Associative Arrays
Associative arrays are arrays that use named keys that you assign to them.
<?php
$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");
echo "Peter is " . $age['Peter'] . " years old.";
?>
PHP - Multidimensional Arrays
A multidimensional array is an array containing one or more arrays.
PHP supports multidimensional arrays that are two, three, four, five, or more levels deep.
However, arrays more than three levels deep are hard to manage for most people.
$cars = array (
array("Volvo",22,18),
array("BMW",15,13),
array("Saab",5,2),
array("Land Rover",17,15)
);
Day 8
PHP - A Simple HTML Form
The example below displays a simple HTML form with two input fields and a submit button:
<html>
<body>
<form action="welcome.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>
</body>
</html>
When the user fills out the form above and clicks the submit button, the form data is sent for
processing to a PHP file named "welcome.php". The form data is sent with the HTTP POST
method.
To display the submitted data you could simply echo all the variables. The "welcome.php"
looks like this:
<html>
<body>
Welcome <?php echo $_POST["name"]; ?><br>
Your email address is: <?php echo $_POST["email"]; ?>
</body>
</html>
The same result could also be achieved using the HTTP GET method:
<html>
<body>
<form action="welcome_get.php" method="get">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>
</body>
</html>
and "welcome_get.php" looks like this:
<html>
<body>
Welcome <?php echo $_GET["name"]; ?><br>
Your email address is: <?php echo $_GET["email"]; ?>
</body>
</html>
The code above is quite simple. However, the most important thing is missing. You need to
validate form data to protect your script from malicious code.
GET vs. POST
$_GET is an array of variables passed to the current script via the URL parameters.
$_POST is an array of variables passed to the current script via the HTTP POST
method.
Day 9
PHP MySQL Database
With PHP, you can connect to and manipulate databases. MySQL is the most popular
database system used with PHP
What is MySQL?
MySQL is a database system used on the web
MySQL is a database system that runs on a server
MySQL is ideal for both small and large applications
MySQL is very fast, reliable, and easy to use
MySQL uses standard SQL
MySQL compiles on a number of platforms
MySQL is free to download and use
MYSQL Database
Create Database
SELECT column_name(s)
FROM table1
RIGHT JOIN table2
ON table1.column_name = table2.column_name;
Day 11
PHP Connect to MySQL
PHP 5 and later can work with a MySQL database using:
MySQLi extension (the "i" stands for improved)
PDO (PHP Data Objects)
Open a Connection to MySQL
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>
Day 12
The INSERT INTO statement is used to add new records to a MySQL table:
INSERT INTO table_name (column1, column2, column3,...)
Day 14
Update Data In a MySQL Table Using MySQLi and PDO
The UPDATE statement is used to update existing records in a table:
UPDATE table_name
SET column1=value, column2=value2,...
WHERE some_column=some_value
Day 15
Delete Data From a MySQL Table Using MySQLi and PDO
The DELETE statement is used to delete records from a table:
DELETE FROM table_name
WHERE some_column = some_value
CONCLUSION
PHP is a great tool for writing dynamic web pages. Non-technical users can easily. learn
a few handy tricks to make their web pages easier to manage, and more useful. Because
its syntax resembles most C-like languages, any Computer Science student is able to
learn it very quickly. When creating a PHP enhanced pages, there are a few things we
must remember PHP is a server side technology, and does not work in a browser. The
filename must have php extension PHP enhanced pages can contain a mixture of HTML
and PHP code PHP code must be enclosed in <?php?> tag. For more PHP information
and tips, please visit php.net, or do a web search.
REFERENCES
www.php net
Wikipedia
http://www.w3schools.com/