Web Technology Assignment (Php, Html, Ajax Codes), Papers of Web Programming and Technologies

Questions on Html, Php, Ajax, and CRUD along with Solutions(Codes) are present in the pdf file

Typology: Papers

2021/2022

Available from 06/09/2022

afifasyeda27
afifasyeda27 🇮🇳

2 documents

1 / 23

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Web Technology Digital Assignment
Slot-F1+TF1
Name: Syeda Afifa
Reg.No: 19BCE7305
Question 1
HTML CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <style>
* {
box-sizing: border-box;
}
/* Create two equal columns that floats next to each other */
.column {
float: left;
width: 50%;
padding: 10px;
height: 300px; /* Should be removed. Only for demonstration */
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
</style>
</head>
<body>
<form>
<h2 align="center">General Admission Registration</h2>
<div class="row">
<div class="column" >
<p>
<label>Name: <input name="firstName" placeholder="first Name" size="6"/><input
name="lastName" placeholder="last Name" size="6"/></label> </p>
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17

Partial preview of the text

Download Web Technology Assignment (Php, Html, Ajax Codes) and more Papers Web Programming and Technologies in PDF only on Docsity!

Web Technology Digital Assignment

Slot-F1+TF

Name: Syeda Afifa

Reg.No: 19BCE

Question 1

HTML CODE

General Admission Registration

Name:

Email:

Gender : Male Female

Phone

Emergency contact

Do you require parking?
Yes No

What is your room preference?
Single Room
Shared Room
No room Needed

Do you have dietary reservation?
None
Vegitarian
Glutten allergy
Lactose allergy
Nut allergy
Shellfish allergy

What activities would you attend?
Award Gala Dinner
Luncheon
Town hall

Do you want to see the list of other attendees and their profile on the official event app?

h1{ text-indent:6in; text-decoration:underline; font-family:sans-serif,cursive; } ol {list-style-type:lower-roman;} ol ol {list-style-type:lower-alpha;} ol ol ol {list-style-type:decimal;}

Family Tree Ordered List

Afifa (Mother-3 Brothers)

Sai Kiran

Harshitha Puppy

Manideep Afsana

Devender

Chandu Mounika


Adithya(Father-3 Sisters)

Nuthana

SreeKrishna Hritik Roshan

Manumitha

Nithin Giri

Neha

Shiva Kartik


Question 3

PHP CODE

php if ($_SERVER["REQUEST_METHOD"] == "POST") { $states = $_POST["states"]; $states=explode(" ", $states); $statesArray =[];

Question 4

A)

HTML CODE

Name:

Age

Favourite color:


PHP CODE

0){ echo "Cookies are enabled
"; $_SESSION["name"] = $name; $_SESSION["age"] = $age; $_SESSION["favcol"] = $favcol; echo "Session variables are set.
"; }else{ throw new Exception("Cookies are not enabled
",1); } }catch(Exception $e){ $message=$e->getMessage(); echo $message; setcookie("test_cookie","test",time()+3600,'/'); echo "Cookies are enabled
"; $_SESSION["name"] = $name; $_SESSION["age"] = $age; $_SESSION["favcol"] = $favcol; echo "Session variables are set.
"; } ?>

4 B)

function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?> PHP Form Validation

* required field

"> Name: *

age: *

height: *

E-mail: *

Website url:



"; fwrite($fp,$age); echo "
"; fwrite($fp,$website); echo "
"; fclose($fp); ?>

Writing into txt file

Question 5

Database.php

}else{ $msg= "Error: ". $query. "
". mysqli_error($connection); } } // convert illegal input to legal input function legal_input($value) { $value = trim($value); $value = stripslashes($value); $value = htmlspecialchars($value); return $value; } ?>

PHP CRUD Operations

input[type=text]:focus, input[type=password]:focus { background-color: #ddd; outline: none;} button[type=submit] { background-color: #434140; color: #ffffff; padding: 10px 20px; margin: 8px 0; border: none; cursor: pointer; width: 100%; opacity: 0.9; font-size: 20px;} label{ font-size: 18px;;} button[type=submit]:hover { background-color:#3d3c3c;} .form-title a, .form-title h2{ display: inline-block; } .form-title a{ text- decoration: none; font- size: 20px; background- color: green; color: honeydew; padding: 2px 10px; }

Create Form

Full Name

Email Address

$city = legal_input($_POST['city']); $country = legal_input($_POST['country']); $query="UPDATE user_details SET full_name='$full_name', email_address='$email_address', city= '$city', country='$country' WHERE id=$id"; $exec= mysqli_query($connection,$query); if($exec){ header('location:user-table.php'); }else{ $msg= "Error: ". $query. "
". mysqli_error($connection); echo $msg; } } // convert illegal input to legal input function legal_input($value) { $value = trim($value); $value = stripslashes($value); $value = htmlspecialchars($value); return $value; } ?>

PHP CRUD Operations

2px solid #f1f1f1; padding: 16px; background-color: white; } .user-detail{ width: 30%; float: left; } input{ width: 100%; padding: 15px; margin: 5px 0 22px 0; display: inline-block; border: none; background: #f1f1f1;} input[type=text]:focus, input[type=password]:focus { background-color: #ddd; outline: none;} button[type=submit] { background-color: #434140; color: #ffffff; padding: 10px 20px; margin: 8px 0; border: none; cursor: pointer; width: 100%; opacity: 0.9; font-size: 20px;} label{ font-size: 18px;;} button[type=submit]:hover { background-color:#3d3c3c;} .form-title a, .form-title h2{ display: inline-block; } .form-title a{ text- decoration: none; font- size: 20px; background- color: green; color: honeydew; padding: 2px 10px; }

$id= $_GET['delete']; delete_data($connection, $id); } // delete data query function delete_data($connection, $id){ $query="DELETE from user_details WHERE id=$id"; $exec= mysqli_query($connection,$query); if($exec){ header('location:user-table.php'); }else{ $msg= "Error: ". $query. "
". mysqli_error($connection); echo $msg; } } ?> User-table.php 0){ $row= mysqli_fetch_all($exec, MYSQLI_ASSOC); return $row; }else{ return $row=[]; } } ?>

PHP CRUD Operations

table, td, th { border: 1px solid #ddd; text- align: left; } table { border-collapse: collapse; max- width: 100%; width:90%; } .table-data{ width:65%; float: right; } th, td { padding: 15px; } body{ overflow-x: hidden; }

  • { box-sizing: border- box;}

CRUD List

S.N Full Name Email Address Course