Web Programming II – Solutions -2017

11. Write a PHP code to perform server-side validation. (Check for empty, alphabets, numbers, email and password length validation) <!doctype html> <html> <head> <title>Year : 2017 | Q : 11</title> </head> <body> <?php function validate($n,$a,$e,$p) { //Checking for empty spaces if($n==”||$a==”||$e==”||$p==”){ echo ‘Empty spaces not permitted’; return false; } //Checking for numbers $regN = “/^[A-Z]+[A-z\s]+[a-z]$/m”; […]

Web Programming II – TU Solution – 2018

11. Write a PHP program to create a form that contains two textboxes that accept numbers and a submit button. When submit button is clicked, the sum of two numbers will be displayed. <!doctype html> <html> <head> <title>Year : 2018 | Q : 11</title> </head> <body> <?php if(isset($_POST[‘add’])) { $n1 = $_POST[‘n1’]; $n2 = $_POST[‘n2’]; […]