PDA

View Full Version : CS506 assignment no 5 fall 2010 solution 29-01-2011



Xpert
01-29-2011, 04:22 PM
Objective:

The objective of this assignment is to provide hands on experience of



§ Setting up PHP
§ Understanding basics of PHP
§ Processing HTML form data and sending response back to client using PHP

Guidelines

§ Code should be properly aligned and well commented.

Problem Statement:

You are required to make a simple web application using PHP that will take Name and Age of Voter. And according to his/her age it will display the message either voter is eligible to vote or not.

You will write a page index.php, this will be simple page that will contain a html form, this page will have simple html so you can either .html extension or .php, i.e. you can just make index.html if you like.

The user will entre his name and age on this page and click on submit
file:///C:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/msohtml1/01/clip_image002.jpg
http://2.bp.blogspot.com/__M5L-C3oo0s/TUO_mmtWiYI/AAAAAAAAAOA/8gx-ee5-HAc/s320/1.JPG
If the age of the user is less then 18 years next page will display message as shown in figure 2.
http://4.bp.blogspot.com/__M5L-C3oo0s/TUO_mdmNvbI/AAAAAAAAAN4/FDp_edeJ5YE/s320/2.JPG

If the age of the user will be equal to or more then 18 year it will display message as shown in Figure # 3
http://3.bp.blogspot.com/__M5L-C3oo0s/TUO_mRf0mOI/AAAAAAAAANw/aPKnctx_Sjg/s320/3.JPG


Solution will be uploaded soon

Anya
02-05-2011, 10:57 PM
Please provide solution asap!!

Xpert
02-06-2011, 01:01 AM
acha u dont have?

Anya
02-08-2011, 01:54 AM
No....wait!!!!!!!

Anya
02-08-2011, 01:56 AM
(page name) index.html


<html>
<head>
<title></title>
</head>
<body>
<form action="result.php" method="post">
Name: <input type="text" name="Name"><br/><br/>
Age: <input type="text" name="Age"><br/><br/>
<input type="submit" name="submit" value="submit">
<input type="reset" name="reset" value="reset">


</form>
</body>
</html>


(page name) result.php


<html>
<head>
<title></title>
</head>
<body>
<?php
$name=$_POST['Name'];
$age=$_POST['Age'];

if($age<=17){
echo "$name you are not eligible to vote";
}
else {
echo " $name you are eligible to vote";

}
?>
</body>
</html>

Anya
02-08-2011, 01:58 AM
I guess so!!