PHP
Section 7
Presented by : Thanaa Mohamed Hassan
What is PHP?
PHP Echo
PHP Variables
CONTENTS PHP Data Types
PHP MySQL Database
The PHP Hypertext Pre-processor (PHP) is a
programming language that allows web developers to
create dynamic content that interacts with databases.
PHP is basically used for developing web-based
software applications.
WHAT IS PHP?
WHAT IS PHP?
PHP ECHO
used to output data to the
screen.
PHP ECHO
In PHP, a variable starts with the $ sign,
followed by the name of the variable:
PHP
VARIABLES
Example
<?php
$txt = "Hello world!";
$x = 5;
$y = 10.5;
?>
OUTPUT VARIABLES
XAMPP INSTALLATION
Go to the XAMPP website (https://sourceforge.net/projects/xampp/files/), choose
XAMPP Windows.
Choose latest stable version and click the installer file to initiate download.
XAMPP for Windows exists in three different flavors:
Installer : Probably the most comfortable way to install XAMPP.
XAMPP INSTALLATION
•After the installation is complete, you will find XAMPP under Start | Programs | XAMPP. You can use the XAMPP
Control Panel to start/stop all server and also install/uninstall services.
XAMPP HTDOCS
Under XAMPP root directory there is a folder called htdocs. That's where you should
put your web site related stuff. For each web site you create, it's better to create a
folder inside htdocs folder and then put content inside that to avoid conflicts.
HOW TO RUN YOUR WEBSITE
To run your website: On the web browser type:
Localhost/name of the folder/name of your page
To run the database:
HOW TO CREATE A DATABASE USING
PHPMYADMIN?
CREATE A TABLE
CREATE A TABLE
CODE OF DB CONNECTION
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "internet4";
$con= mysqli_connect ($servername,$username,$password,$dbname);
if (!$con)
{
die("connectionfailed:" .mysqli_connect_error());
}
else{
echo "Connected successfully";
}
?>
LETS GET STARTED !
OUTPUT:
THE <FORM> ELEMENT
The HTML <form> element is used to create an HTML form for
user input:
The <form> element is a container for different types of input elements, such as:
text fields, checkboxes, radio buttons, submit buttons, etc.
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.
HTML <BUTTON> TAG
HTML <button> Tag
HTML <SELECT> TAG
The <select> element is used to create a drop-down list.