















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Questions on Html, Php, Ajax, and CRUD along with Solutions(Codes) are present in the pdf file
Typology: Papers
1 / 23
This page cannot be seen from the preview
Don't miss anything!
















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
php if ($_SERVER["REQUEST_METHOD"] == "POST") { $states = $_POST["states"]; $states=explode(" ", $states); $statesArray =[];
Name:
Age
Favourite color:
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.
"; } ?>
function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?> PHP Form Validation
* required field
"> Name: *"; fwrite($fp,$age); echo "
"; fwrite($fp,$website); echo "
"; fclose($fp); ?>
Writing into txt file
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; }
CRUD List
S.N Full Name Email Address Course