Welcome! Log In Create A New Profile

Advanced

Topic 2A Problem

Posted by rharris 
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
Topic 2A Problem
July 16, 2008 09:39AM
Hi guys please help with background color I used the script from the masterskill


<?php
switch ($color) {
case "Yellow":
$bgcolor="#FFCC00";
break;
case "Blue":
$bgcolor="4682B4";
break;
case "Silver":
$bgcolor="#C0C0C0";
break;
case "Beige":
$bgcolor= "#FFE4C4";
break;
}
echo "<html>";
echo "<head><title>Selected Background Page</title></head>";
echo "<body bgcolor= '$bgcolor'>";
echo "</body>";
echo "</html>";
?>


And then I tried the one Iris found on S1
still I have a problem please help.

<?php

switch ($_GET['color']) {
case "Yellow":
$bgcolor="#FFCC00";
break;
case "Blue":
$bgcolor="#4682B4";
break;
case "Silver":
$bgcolor="#C0C0C0";
break;
case "Beige":
$bgcolor="#FFE4C4";
break;

}
echo "<html>";
echo "<head><title>Selected Background Page</title></head>";
echo "<body bgcolor='$bgcolor'>";
echo "</body>";
echo "</html>";
?>

Ryan Harris

Ryan Harris
avatar
Mac
Re: Topic 2A Problem
July 16, 2008 09:54AM
What is wrong? Do you het errors or just a blank page? Be more descriptive. have you read through all the previous forums on this topic?

EG: http://osprey.unisa.ac.za/phorum/read.php?205,57801,60675#msg-60675
Re: Topic 2A Problem
July 16, 2008 11:09AM
yes I did read the the previous forum . and Its a blank & no errors

Ryan Harris
avatar
Mac
Re: Topic 2A Problem
July 16, 2008 11:22AM
What I am saying is that there is nothing wrong elsewhere. it works.
So something else is amiss.

This is colorselect.html

<html>
<head></head>
<body>
<form method=GET action='color.php'>
Choose a Web page background color
<br>
<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'>
</form>
</body>
</html>

This color.php

<?php

switch ($_GET['color']) {
case "Yellow":
$bgcolor="#FFCC00";
break;
case "Blue":
$bgcolor="#4682B4";
break;
case "Silver":
$bgcolor="#C0C0C0";
break;
case "Beige":
$bgcolor="#FFE4C4";
break;

}
echo "<html>";
echo "<head><title>Selected Background Page</title></head>";
echo "<body bgcolor='$bgcolor'>";
echo "</body>";
echo "</html>";
?>


You go http:// localhost/colorselect.html, choose a color, then it must work
Re: Topic 2A Problem
July 16, 2008 03:08PM
Thanks Mac Ive got it right .I guess im done with 2A


Thanks

Ryan Harris
Anonymous User
Re: Topic 2A Problem
July 20, 2008 01:00PM
Completed with.

Thanx
Mamog
Re: Topic 2A Problem
August 13, 2008 01:24PM
Finally found joy
I used ($_GET['color']) in place of ($color)
it seems that $color variable was not defined or retrieved from the colorselect.html form.


Sharp sharp
Thanks Mac!!!

Aint it over 'til it is
Re: Topic 2A Problem
August 22, 2008 02:33PM
I forgot to let all know that the I have also been successful with this task and after the help here I understand it much better.

JB
Sorry, only registered users may post in this forum.

Click here to login