Sie sind auf Seite 1von 7

Dr.

D Y Patil School of MCA Lohegaon, Pune

MCA I SEM II,

Internal Examination Apr/May 2020

Subject: - Web Technologies (2019-20 Pattern)

Subject Code:- IT22

Marks: - 50 Marks

Q 1) Design Student registration form, form can contain following input field. (25 marks)

1. Enter student Name.


2. Enter student address
3. Enter student date of birth
4. Select students qualification
5. Select students gender
6. Enter students mobile number
7. Enter students Email id
8. Select students city
9. Display students photo at top right corner of form

Solution:

<!DOCTYPE HTML>

<html>

<body>

<form action=”/student .php”>

Student name:

<input type=”text” name=”sname”

Placeholder=”please enter your name”

Pattern =”[A-Za-Z]”> <br>

Student address:

<input type=”text name =”address”

Placeholder=”please enter address”> <br>


Date of birth:

<input type=”date” name=”birthday”

Max=”2020-19-04”> <br>

Students Qualification:

<select name=”dropdown”>

<option value=”HSC”> HSC</option>

<option value=”Bsc.cs”>Bsc.cs</option>

<option value=”MCA”>MCA</option>

</select>

Student Gender:

<input type=”radio” name=”Gender” value=”Male”/>

<input type=”radio” name=” Gender” value=Female”/>

Mobile Number:

<input type=”text” name=”mobno”

Pattern=”[0-9]” max=”10”> <br>

Email id:

<input type=”email” name=”email”><br>

Student city:

<select name=dropdown” select size=1>

<option value=”pune”>pune</option> <br>

<option value=”mumbai”>mumbai</option> <br>

<option value=”nagpur”>nagpur</option>

</select>

Display student photo:

<input type=”image” src=”img-submit.gif” alt=”submit” width=”48” height=”48”>


</form>

</body>

</html>

Do the following validation

1. Students name should accept only A to Z small or upper or both

Student name:

<input type=”text” name=”sname”

Placeholder=”please enter your name”

Pattern =”[A-Za-Z]”> <br>

2. Students date of birth should not greater than current date

><input type="date" name="dob" id="dob" maxlength="100"


required="required"/>

(Please enter in DD/MM/YYYY format)

<script type="text/javascript">

var today = new Date();

var dd = today.getDate();

var mm = today.getMonth()+1;

var yyyy = today.getFullYear();

if(dd<10){

dd='0'+dd

if(mm<10){

mm='0'+mm

}
today = yyyy+'-'+mm+'-'+dd;

document.getElementById("dob").setAttribute("max", today);

</script>

3. Students mobile number will accept only numbers

Mobile Number:

<input type=”text” name=”mobno”

Pattern=”[0-9]” max=”10”> <br>

4. Do proper validation for email id


<input type=”email” name=”email”><br>

Q 2) Write PHP code for the following [refer above form] (25 marks)

1. User can easily add new students in the database


2. User can view all registered students in the tabular format
3. User can delete specific student
4. User can modify students existing data

<?php

$hostname="localhost";

$username="root";

$password=" '';

$database="student";

$con=mysql_connect($hostname,$username,,$password);

if(!$con)

{
die("connection failed".Mysql_error());

Mysql_select_db($database,$con);

$sql="CREATE TABLE student {student name varchar(30) NOTNULL,address varchar(30) NOT


NULL,date_of_birth,date,qualification varchar(30),gender varchar(6),mobile_number
number(10),Email_id varchar(30),city varchar(30)}";

if(Mysqli_query($conn,sql))

echo"Table Student Created Sucessfully";

else

echo"Error creating table:".mysqli_error($conn);

$sql="INSERT INTO Student Values("Raj",

"pune camp",1998-07-05,"MCA",

9543216541,"Mumbai")";

if(Mysqli_query($conn,$sql))

echo "New record created sucessfully";

else

echo "Error:".$sql."<br>".Mysqli_error($conn);

$sql="select * from student";


$result=Mysqli_query($conn,$sql);

if(Mysqli_num_rows($result)>0)

while($row=Mysqli_fetch_assoc($result))

echo"student_name:".row["student_name']."address:"

.$row["address"].date_of_birth.$row[dateofbirth"].

"qualification.$row["Qualification"]."mobileno:".

$row["Number'']" city:".$row["city"]."<br>";

else

echo "0 results";

$sql="Delete from student where student_name="Raj";

if(Mysqli_query($conn,$sql))

echo "Record Deleted Successfully";

else

echo "Error Deleting Record: ".Mysql_error($conn);

$sql="UPDATE Student SET Student_name="Rajesh" where Student_name="Raj";


if(Mysqli_query($conn,$sql))

echo "Record Updated Successfully";

else

echo "Error Updating Record: "Mysql_error($con);

Mysqli_close($conn);

?>

Note:- students has to solve above 2 question and send soft copy to me on my email id
a_deokar@rediffmail.com
For any queries call on 9922914612

Last date of submit is on or before 19-04-2020 5pm.

Das könnte Ihnen auch gefallen