0% found this document useful (0 votes)
58 views

Ex No: 2 (B) Registration Form: Source Code

The document contains a registration form with various input fields like name, email, password, date of birth etc. along with a PHP code to display the submitted form data. The form uses HTML and CSS for layout and styling. It contains input fields like text, email, password, number, radio buttons, date, file etc and allows submitting user details along with resume upload.

Uploaded by

Mohammed Irfan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views

Ex No: 2 (B) Registration Form: Source Code

The document contains a registration form with various input fields like name, email, password, date of birth etc. along with a PHP code to display the submitted form data. The form uses HTML and CSS for layout and styling. It contains input fields like text, email, password, number, radio buttons, date, file etc and allows submitting user details along with resume upload.

Uploaded by

Mohammed Irfan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Ex No: 2(b) REGISTRATION FORM

Source Code:

<html>
<head>
<style>
form{
margin:0 auto;
width:450px;
background-color: silver;
padding:20px;
}
h2{
text-align: center;
}
</style>
</head>

<body>
<form name="myform" method="post" action="showdata.php">
<h2>Registration Form</h2>
<fieldset>
<legend>Personal Details:</legend>
<table>
<tr>
<td><label for="username">Name:</label></td>
<td><input type="text" id="username" name=”username” placeholder="Enter the name"
autocomplete="on" required></td>
</tr>
<tr>
<td><label for="email">Email:</label></td>
<td><input type="email" id="email" name=”email” autocomplete="on" required></td>
</tr>
<tr>
<td><label for="pass">Password:</label></td>
<td><input type="password" id="pass" name=”password” required></td>
</tr>
<tr>
<td><label for="age">Age:</label></td>
<td><input type="number" id="age" name=”age” min="18" max="50" required></td>
</tr>
<tr>
<td><label>Gender:</label></td>
<td><input type="radio" name="gender" value="Male">Male
<input type="radio" name="gender" value="Female">Female</td>
</tr>
<tr>
<td><label for="dob">Date of Birth:</label></td>
<td><input type="date" id="dob" name=”dob” min="01-01-1990" max="12-31-2018"
required></td>
</tr>
<tr>
<td><label for="num">Contact No:</label></td>
<td><input type="tel" id="num" name=”num” pattern="^[0-9]{10}$"></td>
</tr>
<tr>
<td><label for="web">Web Address:</label></td>
<td><input type="url" name=”web” id="web"></td>
</tr>
<tr>
<td><label>Rate this Form:</label></td>
<td><input type="range" name=”rate” min="0" max="25" step="5" value="10"></td>
</tr>
<tr>
<td><label>Favourite Color:</label></td>
<td><input type="color" name=”color”></td>
</tr>
<tr>
<td><label>Branch of Study:</label></td>
<td><select name=”branch”>
<option>Chemistry</option>
<option>Commerce</option>
<option>Computer Science</option>
<option>Mathematics</option>
<option>Physics</option>
</select></td>
</tr>
<tr>
<td><label>Language Known:</label></td>
<td>
<input type="checkbox" name=”languages[]” value="C++" checked>C++
<input type="checkbox" name=”languages[]” value="Java">Java
<input type="checkbox" name=”languages[]” value="Perl">Perl
<input type="checkbox" name=”languages[]” value="PHP">PHP
<input type="checkbox" name=”languages[]” value="Python">Python
</td>
</tr>
<tr>
<td><label>Upload Resume:</label></td>
<td><input type="file" name=”resume” required></td>
</tr>
<tr>
<td><label for="remark">Remarks:</label></td>
<td><textarea name=”remark” rows="6" cols="20" draggable="true"
id="remark"></textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Submit">
<input type="reset" value="Clear"></td>
</tr>
</table>
</fieldset>
</form>
</body>
</html>

Showdata.php:

<?php
echo “Name : ”.$_POST[‘username’].”<br>”;
echo “Email : ”.$_POST[‘email’].”<br>”;
echo “Password : ”.$_POST[‘password’].”<br>”;
echo “Age : ”.$_POST[‘age’].”<br>”;
echo “Gender : ”.$_POST[‘gender’].”<br>”;
echo “Date of Birth : ”.$_POST[‘dob’].”<br>”;
echo “Contact No : ”.$_POST[‘num’].”<br>”;
echo “Web Address : ”.$_POST[‘web’].”<br>”;
echo “Rating : ”.$_POST[‘rate’].”<br>”;
echo “Colour : ”.$_POST[‘color’].”<br>”;
echo “Branch : ”.$_POST[‘branch’].”<br>”;
foreach($_POST[‘languages’] as $row)
echo $row.”,”;
echo “Resume : ”.$_POST[‘resume’].”<br>”;
echo “Remark : ”.$_POST[‘remark’].”<br>”;
?>
Output:

Name : Joy William

Email : [email protected]

Password : …….
Age : 21

Gender : Male

Date of Birth : 04-11-1996

Contact No : 0123456789

Web Address : http://sample.com

Rating : 10

Colour : red;

Branch : Computer Science

Resume : resume.txt

Remark :

You might also like