Welcome! Log In Create A New Profile

Advanced

TASK 5A

Posted by Reinie 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
TASK 5A
April 18, 2007 11:49AM
Completed
Re: TASK 5A
April 22, 2007 04:12PM
All good - completed
Re: TASK 5A
April 23, 2007 10:47PM
Completed
Re: TASK 5A
April 24, 2007 11:53AM
Completed
Re: TASK 5A
April 25, 2007 06:23AM
Completedsmile
Re: TASK 5A
April 29, 2007 07:58PM
All Good.

smile
avatar Re: TASK 5A
May 01, 2007 06:29AM
Completed after several attempts at getting the values assigned to $fname and $lname to show up on the output.

For me, this task was a reminder that variables are assigned to the name attribute of a form field and not the value.

I think I am learning something good...

A Successful Nature Inspires Other People...
Re: TASK 5A
May 05, 2007 04:59PM
Completed.
Re: TASK 5A
May 07, 2007 11:29PM
Completed
Re: TASK 5A
May 09, 2007 09:16PM
Completed smiling smiley
Re: TASK 5A
May 12, 2007 05:50PM
Done
WjS
Re: TASK 5A
May 15, 2007 09:19AM
finished.
Re: TASK 5A
May 20, 2007 06:57PM
DotKhoza

How did you manage to show it on the output, i'm still puzzling ?
Re: TASK 5A
May 22, 2007 10:05AM
Try something like this :-

<?php
session_start();

if (isset ($_GET['color']))
{
$color = $_GET['color'];

switch ($color) {

case "Yellow":
$_SESSION['bgcolor']="#FFCC00";
break;
case "Blue":
$_SESSION['bgcolor']="#4682B4";
break;
case "Silver":
$_SESSION['bgcolor']="#C0C0C0";
break;
case "Beige":
$_SESSION['bgcolor']="#FFE4C4";
break;
default:
$_SESSION['bgcolor'] = "white";
break;
} // end switch
}


if (!isset($_SESSION['bgcolor'])) $_SESSION['bgcolor'] = "white";


?>
<html>
<head><title>Session Example</title></head>

<body bgcolor='<?php echo $_SESSION['bgcolor']; ?>'>
<p> The page Color is <?php echo $_SESSION['bgcolor'] ?> </p><hr>

<form method=GET action='session.php?<?php echo SID; ?>'>
<p>
Select a new background color :-
<br>
<input name='color' TYPE='radio' VALUE='Yellow'> Yellow
<br>
<input name='color' TYPE='radio' VALUE='Blue'> Blue
<br>
<input name='color' TYPE='radio' VALUE='Silver'> Silver
<br>
<input name='color' TYPE='radio' VALUE='Beige'> Beige
<br>
<br>
<input type='submit' value='Change background color'>
<br><br>
<?php echo "Your Session ID is currently ".session_id(); ?>
<br>
</p>
</form>
<hr><p>
<a href='session.php?<?php echo "sess" ?>'>Refresh page, Don't change background color</a>
<br><br>
<a href='session2.php?<?php echo "sess" ?>'>To other page</a>
</p>
</body>
</html>
Re: TASK 5A
May 22, 2007 10:17AM
Umm is this for the same exmaple 5A ?
Re: TASK 5A
May 22, 2007 12:51PM
Ah , that might have been 5B !

What problem are you havng.
Re: TASK 5A
May 22, 2007 03:34PM
i cant seem to get $fname and $lname to output in Example 5A
Sorry, only registered users may post in this forum.

Click here to login