Het PHP 3
Het PHP 3
Practical:-3.1
Aim:- Create student registration form using text box, check box, radio
button, select, submit button. And display user inserted value in new PHP
page.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body
{
margin: 20px;
}
input
{
background-color: white;
background-position: 10px 10px;
background-repeat: no-repeat;
padding-left: 40px;
margin: 5px;
}
input[type=text]:focus {
border: 3px solid green;
}
.myDiv {
border: 5px outset black;
background-color:palevioletred;
text-align: center;
margin: 20px;
}
</style>
</head>
<body>
<?php
if(isset($_GET['s'])){
?>
<div class="myDiv">
<?php
$hobby=$_GET['h'];
echo"Welcome..." . $_GET['un'];
echo"</br>Email :". $_GET['e'];
echo"</br>en.number :". $_GET['en'];
echo"</br>Your DOB is :". $_GET['DOB'];
22171341092 practical:-3 php
Output:-
Practical:-3.2
Aim:- Create Website Registration Form using text box, check box, radio
button, select, submit button. And display user inserted value in same PHP
page.(PHP_SELF).
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Website registration Form</title>
<style>
body
{
margin: 30px;
}
input
{
background-color: white;
background-position: 10px 10px;
background-repeat: no-repeat;
padding-left: 40px;
margin: 2px;
}
input[type=text]:focus {
border: 3px solid green;
}
.myDiv {
22171341092 practical:-3 php
<div class="myDiv">
<?php
if($_SERVER['REQUEST_METHOD']=="POST"){
if(isset($_POST['s'])){
$name=$_POST['un'];
$lname=$_POST['un2'];
echo"hello...!!$name $lname";
echo"</br>Email ID:". $_POST['e'];
echo"</br>Your DOB is :". $_POST['DOB'];
echo"</br>Your gender is :". $_POST['g'];
}
}
?>
</div>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
First Name: <input type="text" name="un" placeholder="Enter your first
name"></br>
Last Name: <input type="text" name="un2" placeholder="Enter your last
name"></br>
Your Email: <input type="email" name="e" placeholder="Enter your email"><br/>
Password: <input type="password" name="p" placeholder="Enter your
password"><br/>
Gender:<input type="radio" name="g" value="Male">male
<input type="radio" name="g" value="Female">female</br>
DOB:<input type="date" name="DOB"></br>
<input type="Submit" name="s" value="Sign Up" >
<input type="reset">
</form>
</body>
</html>
Output:-
22171341092 practical:-3 php
Practical:-3.3
Aim:- : Create employee registration form using text box, checkbox, radio
button, select, submit button. And display user inserted value in new PHP
page using $_REQUEST[].
<?php
if (isset($_REQUEST['submit'])) {
echo "<h2>Employee Registration Details</h2>";
echo "Name: " . $_POST['name'] . "<br>";
echo "Employee ID: " .$_POST['empid'] . "<br>";
echo "Email: " . $_POST['email'] . "<br>";
echo "Mobile Number: " . $_POST['mobile'] . "<br>";
echo "City: " . $_POST['city'] . "<br>";
echo "Date of Birth: " .$_POST['dob']. "<br>";
echo "Skills: ";
if (isset($_POST['skills'])) {
echo implode(", ", $_POST['skills']). "<br>";
} else {
echo "None<br>";
}
if (isset($_POST['gender'])) {
echo "Gender: " . $_POST['gender'] . "<br>";
} else {
echo "Gender: Not specified<br>";
}
echo "Department: " . $_POST['department'] . "<br>";
} ?>
<div class="form-container">
<h2>Employee Registration Form</h2>
<form action="ref33.php" method="post">
<label for="name">Full Name:</label>
<input type="text" id="name" name="name"><br><br>
<label for="empid">Employee ID:</label>
22171341092 practical:-3 php
Output:-
22171341092 practical:-3 php
Practical:-3.4
Aim:- Create PHP script that can upload any 3 type of file to the specific
folder.
<!DOCTYPE html>
<html>
<head>
<title>file upload p34</title>
<style>
div{
position:absolute;
top:50px;
right: 90px;;
width:200px;
height:150px;
padding-left:5px; }
</style>
</head>
<body>
<div>
<?php
if (isset($_POST['submit'])) {
if(isset($_FILES['file1']['tmp_name']))
{
move_uploaded_file($_FILES['file1']['tmp_name'],"../../img/". $_FILES['file1']['name']);
echo "<h3> File uploaded </h3>";
}
else
{
echo "<h3>ERROR...!!! in file upload</h3>";
}
echo "Full Name: " . $_POST['name'] . "<br>";
echo "Username: " . $_POST['username'] . "<br>";
echo "Email: " . $_POST['email'] . "<br>";
echo "Gender: " . $_POST['gender'] . "<br>";
}
?>
</div>
<!-- Registration Form -->
<form method="post" enctype="multipart/form-data">
<label>Full Name:</label>
<input type="text" name="name"><br><br>
<label>Username:</label>
<input type="text" name="username"><br><br>
<label>Email:</label>
22171341092 practical:-3 php
Output:-