3) : Write a PHP script having 3 textboxes. The first textbox should be for accepting name of the student, second for accepting name of college and third for accepting a proper greeting message. Write a function for accepting all the three parameters and generating a proper greeting message. If any of the parameters are not passed, generate the proper greeting message. (Use the concept of missing parameters)
HTML CODE:
<html>
<body>
<form action="b3.php" method="GET">
Enter Name of Student: <input type="text" name="stud"><br><br>
Enter Name of College: <input type="text" name="clg"><br><br>
Enter Greeting Message: <input type="text" name="msg"><br><br>
<input type="submit" value="submit">
</form>
</body>
</html>
PHP CODE:
<?php
$a=$_GET['stud'];
$b=$_GET['clg'];
$c=$_GET['msg'];
/*
//if($a==NULL)
args($a);
/*else if( $b==NULL)
{args($a,$c);
}else if($c==NULL)
{args($a,$b);
}else
{args($a,$b,$c);
}
*/
args($a,$b,$c);
function args($a,$b,$c)
{
if($a==NULL || $b==NULL || $c==NULL)
//if(func_num_args() < 3)
echo "Missing argumenets";
else
echo $c;
}
?>
Comments
Post a Comment