Tivr-22171371100
IT-C43
PRACTICAL 3.1- Create Student registration from 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>studentform</title>
</head>
<body>
<div class="head">
<h1>Register Form </h1>
</div>
<form class="form" action="get.php" method="get">
<br>
NAME <input type="text" name="name" id="name"><br><br>
ENROLLMENT NO <input type="number" name="enroll" id="enroll"><br><br>
GENDER <input type="radio" name="gen" value="male">Male
<input type="radio" name="gen" value="female">Female<br><br>
Branch <select name="branch" >
<option value="ce">CE</option>
<option value="it">IT</option>
<option value="mech">MECH</option>
<option value="civil">CIVIL</option>
</select><br><br>
HOBBY <input type="checkbox" name="hobby" value="cricket">Cricket
<input type="checkbox" name="hobby" value="badminton">badminton
<input type="checkbox" name=hobby" value="football">football
</br> <button name="submit" >SUBMIT </button>
</form>
<?PHP
if(isset($_GET['submit'])){
echo 'ur name is... '.$_GET['name'];
echo '</br>';
echo ' ur Enrollment no is... '.$_GET['enroll'];
echo '</br>';
echo 'ur gender is...'.$_GET['gen'];
echo '</br>';
echo ' ur branch is... '.$_GET['branch'];
echo '</br>';
echo 'ur hobby is... '.$_GET['hobby'];
echo '</br>';
?>
</body>
</html>
output:-
Tivr-22171371100
IT-C43
PRACTICAL-3.2 Create Website registration from 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>register</title>
</head>
<body>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
NAME:-<input type="text" name="name" placeholder="enter your name">
<br><hr>
EMAIL:-<input type="email" name="emails"placeholder="enter email id">
<br><hr>
PASSWORD:-<input type="password" name="pass"placeholder="enter password">
<br><hr>
GENDER:-<input type="radio" name="gender" value="male" selected>male
<input type="radio" name="gender" value="female">female
<input type="radio" name="gender" value="transgender">transgender
<br><hr>
HOBBY
<input type="checkbox" name="h[]" value="Playing outdoor game">Playing outdoor game
<input type="checkbox" name="h[]" value="Playing indoor game">Playing indoor game
<input type="checkbox" name="h[]" value="Reading Book">Reading Book
<input type="checkbox" name="h[]" value="coding">Coding
<br><hr>
<input type="submit" name="submit">
</form>
<table>
<?php
if(isset($_POST['submit'])){
echo "name...." . $_POST['name'] ."<br>";
echo "email....". $_POST['emails'] ."<br>";
echo "password....". $_POST['pass'] ."<br>";
echo "gender....".$_POST['gender'] ."<br>";
echo "hobby....";
if(isset($_POST['h'])){
foreach($_POST['h'] as $selected){
echo $selected;
?>
</table>
</body>
</html>
output:-
Tivr-22171371100
IT-C43
PRACTICAL 3.4 Create PHP script that can upload any type of file to the specific folder.
<!DOCTYPE html>
<html lang="en">
<head>
<title> file</title>
</head>
<body>
<form method="post" enctype="multipart/form-data">
<input type="file" name="file">
<button type="submit" name="submit">submit</button>
<form>
<?php
if(ISSET($_POST['submit'])){
if(move_uploaded_file($_FILES['file']['tmp_name'],"C:\Users\ptlsl\OneDrive\Pictures\Documents\php/".
$_FILES['file']['name'])){
echo "File uploaded successfully"; }else{
echo "Failed to upload file"; } }
?>
</body>
</html
output:-