Change the preferences of your web page like font style, font size,
font color, background color using cookie. Display selected settings on
next web page and actual implementation (with new settings) on third
web page.
ex6setb2b.html
<html>
<head><title>SETB2 PROGRAM</title></head>
<body>
<form action="ex6setb2b.php" method="post">
FONT STYLE<input type="text"name="fstyle"><br>
FONT SIZE<input type="text"name="fsize" ><br>
FONT COLOUR<input type="text"name="fcolour"><br>
BACKGROUND COLOUR<input type="text"name="bcolour"><br>
<input type="submit"name="submit" value="submit">
</form>
</body>
</html>
ex6setb2b.php
<?php
$fstyle=$_POST['fstyle'];
$fsize=$_POST['fsize'];
$fcolour=$_POST['fcolour'];
$bcolour=$_POST['bcolour'];
setcookie("fstyle","$fstyle",time()+3660);
setcookie("fsize","$fsize",time()+3600);
setcookie("fcolour","$fcolour",time()+3600);
setcookie("bcolour","$bcolour",time()+3600);
echo "<h1> YOUR PREFERENCES </h1><br>";
echo "FONT STYLE:<b>$fstyle</b><br>";
echo "FONT SIZE:<b>$fsize px</b><br>";
echo "FONT COLOUR:<b>$fcolour</b><br>";
echo "BACKGROUND COLOUR:<b>$bcolour</b><br>";
?>
<html>
<form action="ex6setb2c.php" method="post">
<input type="submit" value="click to apply preferences">
</form>
</html>
ex6setb2c.php
<?php
$fstyle=$_COOKIE['fstyle'];
$fsize=$_COOKIE['fsize'];
$fcolour=$_COOKIE['fcolour'];
$bcolour=$_COOKIE['bcolour'];
?>
<html>
<body bgcolor="<?php echo $bcolour?>">
<font size="<?php echo $fsize?>" color="<?php echo $fcolour?>" face="<?php echo $fstyle?>"> ALL PROPERTIES ARE APPLIED</font>
</body>
</html>
0 Comments
If anyone has Doubts or suggestions please let me know