Project Report
Project Report
DEPARTMENT OF COMPUTER
ENGINEERING
DEPARTMENT OF COMPUTER
ENGINEERING
Project Report on
Computer Engineering
To
M.S.B.T.E. MUMBAI.
By
Ms.P.R.Chougule
CERTIFICATE
Have successfully completed the Project work entitled “Student registration form using
PHP” under my supervision, in the partial fulfillment of the requirements for the Diploma in
Computer Engineering, and the report submitted to M.S.B.T.E. MUMBAI. For academic year
2020-2021. Semester VI.
Date:
Place: S.I.T.Poly. Yadrav
Date:
Place: S.I.T.Poly. Yadrav
Date:
Place: S.I.T.Poly. Yadrav
Date:
Place: S.I.T.Poly. Yadrav
ACKNOWLEDGMENT
I express thanks to my family and friends for their support and encouragement at every
stage of successful completion of this project work.
My sincere thanks to all those who have directly or indirectly helped me to carry out this
work.
INDEX
Sr.no Title Page no.
1 Introduction
2 Actual methodology followed
3 Aim
7 Conclusion
8 Reference
Empty String:
The code below checks that the field is not empty. If the user leaves the
required field empty, it will show an error message. Put these lines of code to
validate the required field.
Validate String:
The code below checks that the field will contain only alphabets and
whitespace, for example - name. If the name field does not receive valid
input from the user, then it will show an error message
Validate Number:
The below code validates that the field will only contain a numeric value. For
example - Mobile no. If the Mobile no field does not receive numeric data from
the user, the code will display an error message.
Validate Email:
A valid email must contain @ and . symbols. PHP provides various methods to
validate the email address. Here, we will use regular expressions to validate the
email address.
The below code validates the email address provided by the user through
HTML form. If the field does not contain a valid email address, then the code
will display an error message.
Input Length Validation:
The input length validation restricts the user to provide the value between the
specified range, for Example - Mobile Number. A valid mobile number must
have 10 digits.
The given code will help you to apply the length validation on user input.
The below code validates the URL of website provided by the user via HTML
form. If the field does not contain a valid URL, the code will display an error
message, i.e., "URL is not valid".
Button Click Validate:
Validates that the user click on submit button and send the form data to the
server one of the following method - get or post.
Now we will apply all these validations to an HTML form to validate the fields.
Thereby you can learn in detail how these codes will be used to validation form.
Create a registration form using HTML and perform server-side validation.
Follow the below instructions as given.
Fill the registration form and click on the Submit button. If all required
information is provided correctly, the output will be displayed on the same
page below the submit button.
3 Aim-
To design student registration form using PHP .
Name
Sr.no. Specifications Quantity Remarks
of Resources
Windows 7 or later version,
1. Computer System Yes
RAM minimum 2.0 GB, 1
Processor – Intel core i3 or i5
https://www.javatpoint.com/
3. Websites form-validation-in-php Yes
1
Programming PHP-Author-
1
4. Reference Books Rasums Lerdorf, Kevin. T Yes
and Peter M.
<?php
// define variables to empty values
$nameErr = $emailErr = $mobilenoErr = $genderErr = $websiteErr = $agreeErr = "";
$name = $email = $mobileno = $gender = $website = $agree = "";
//String Validation
if (emptyempty($_POST["name"])) {
$nameErr = "Name is required";
} else {
$name = input_data($_POST["name"]);
// check if name only contains letters and whitespace
if (!preg_match("/^[a-zA-Z ]*$/",$name)) {
$nameErr = "Only alphabets and white space are allowed";
}
}
//Email Validation
if (emptyempty($_POST["email"])) {
$emailErr = "Email is required";
} else {
$email = input_data($_POST["email"]);
// check that the e-mail address is well-formed
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$emailErr = "Invalid email format";
}
}
//Number Validation
if (emptyempty($_POST["mobileno"])) {
$mobilenoErr = "Mobile no is required";
} else {
$mobileno = input_data($_POST["mobileno"]);
// check if mobile no is well-formed
if (!preg_match ("/^[0-9]*$/", $mobileno) ) {
$mobilenoErr = "Only numeric value is allowed.";
}
//check mobile no length should not be less and greator than 10
if (strlen ($mobileno) != 10) {
$mobilenoErr = "Mobile no must contain 10 digits.";
}
}
//URL Validation
if (emptyempty($_POST["website"])) {
$website = "";
} else {
$website = input_data($_POST["website"]);
// check if URL address syntax is valid
if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-
z0-9+&@#\/%=~_|]/i",$website)) {
$websiteErr = "Invalid URL";
}
}
<h2>Registration Form</h2>
<span class = "error">* required field </span>
<br><br>
<form method="post" action="<?php echo
htmlspecialchars($_SERVER["PHP_SELF"]); ?>" >
Name:
<input type="text" name="name">
<span class="error">* <?php echo $nameErr; ?> </span>
<br><br>
E-mail:
<input type="text" name="email">
<span class="error">* <?php echo $emailErr; ?> </span>
<br><br>
Mobile No:
<input type="text" name="mobileno">
<span class="error">* <?php echo $mobilenoErr; ?> </span>
<br><br>
Website:
<input type="text" name="website">
<span class="error"><?php echo $websiteErr; ?> </span>
<br><br>
Gender:
<input type="radio" name="gender" value="male"> Male
<input type="radio" name="gender" value="female"> Female
<input type="radio" name="gender" value="other"> Other
<span class="error">* <?php echo $genderErr; ?> </span>
<br><br>
Agree to Terms of Service:
<input type="checkbox" name="agree">
<span class="error">* <?php echo $agreeErr; ?> </span>
<br><br>
<input type="submit" name="submit" value="Submit">
<br><br>
</form>
<?php
if(isset($_POST['submit'])) {
if($nameErr == "" && $emailErr == "" && $mobilenoErr == "" && $genderErr == ""
&& $websiteErr == "" && $agreeErr == "") {
echo "<h3 color = #FF0001> <b>You have sucessfully registered.</b> </h3>";
echo "<h2>Your Input:</h2>";
echo "Name: " .$name;
echo "<br>";
echo "Email: " .$email;
echo "<br>";
echo "Mobile No: " .$mobileno;
echo "<br>";
echo "Website: " .$website;
echo "<br>";
echo "Gender: " .$gender;
} else {
echo "<h3> <b>You didn't filled up the form correctly.</b> </h3>";
}
}
?>
</body>
</html>
Output Screenshot :
6 Conclusion-
We are completed Student Registration From in PHP.
We are create a where student can register themselves.Registration requires
everywhere, either we are filling any form or want to access any application. So
in this project we will see how to implement student registration in PHP
7 References:
https://www.javatpoint.com/form-validation-in-php
Book:-
Programming PHP-