School Map:  Home / Enroll $ Student Records; Class  
$ News @ LIVE Tech Radio * Support/FAQ | Store | FORUMS

 

 (#450 2004-01-04 04:55:20) Post Reply
Page 0 1 2 3 4 5

Ahkorahil
Need To Set


Enrolled: Oct 2003
Posts: 20
AP: 1

eeem.... so little mistake, why didn't I notice it :P

thanks Quicksaver :D

 

 (#458 2004-01-09 20:13:34) Post Reply
Page 0 1 2 3 4 5

Ash2k4
Need To Set


Enrolled: Jan 2004
Posts: 7
AP: 1



<HTML>
<HEAD>
<TITLE>ScriptSchool.com - 16 week PHP Course - TO-DO ASSIGNMENT #2</TITLE>
</HEAD>
<BODY>
<?
$today
= date("w");
$url_0 = "<A HREF=\"http://www.scriptschool.com\">ScriptSchool.com</a> - Learn programming and the technical side of webmastering";
$url_1 = "<A HREF=\"http://www.yahoo.com\">Yahoo!</a> - One of the most popular search engines on the web";
$url_2 = "<A HREF=\"http://www.my-symbian.com\">My-Symbian.com</a> - Symbian OS Communicators and Smartphones Info Center";
$url_3 = "<A HREF=\"http://www.militaryforums.co.uk\">Military Forums</a> - provides a site with forums to discuss your military related issues from general discussion to training";
$url_4 = "<A HREF=\"http://www.allmusic.com\">All Music Guide</a> - a guide and information resource for all genres of music";
$url_5 = "<A HREF=\"http://www.ebay.com\">eBay</a> - a very popular online auctioning community";
$url_6 = "<A HREF=\"http://www.poolgame.co.uk\">Pool Sharks</a> - a free online pool game";
switch(
$today)
{
case
"0":
$url = $url_0;
break;
default:
case
"1":
$url = $url_1;
break;
default:
case
"2":
$url = $url_2;
break;
default:
case
"3":
$url = $url_3;
break;
default:
case
"4":
$url = $url_4;
break;
default:
case
"5":
$url = $url_5;
break;
default:
case
"6":
$url = $url_6;
break;
default:
}
$todaytext = date("l");
print(
"<b>$todaytext's Link:</b> $url")
?>
</BODY>
</HTML>


 

 (#466 2004-01-13 16:16:56) Post Reply
Page 0 1 2 3 4 5

Sety
Need To Set


Enrolled: Jan 2004
Posts: 5
AP: 1

<?
switch(date("w"))
{
case "0":$url = "<a href=\"http://www.sety.go.ro\">Sety Power</a>...is my site motherfucker."; break;
case "1":$url = "<a href=\"http://www.tranceaddict.com\">Trance music lovers</a><br>...damn good trance music."; break;
case "2":$url = "<a href=\"http://www.slsk.org\">Soulseek</a>...a place where u can take music motherfucker."; break;
case "3":$url = "<a href=\"http://www.animationcity.com\">Animatin City</a>...there is lots gif formats."; break;
case "4":$url = "<a href=\"http://www.cooltext.com\">Cool Text</a>...damn interesting words format are there."; break;
case "5":$url = "<a href=\"http://www.radiototal.ro\">Radio TOTAL</a>...the best music that u ever can hear motherfuckers."; break;
case "6":$url = "<a href=\"http://www.google.com\">Google</a>Google search engine..you rat !!!"; break;
}
print ("The day site motherfuker is ". $url);

/*NOTE:Where the hell in the lesson 2 are write about site adress and how supouse i read about that.Somebody who didn't know HTML
i think it was in hell until now...or probably everybody must have HTML knowleadge when subscribe to this curs?

I have damn it with lesson 2!!!
Next...what the hell!!!
CYA */
?>



 

 (#467 2004-01-13 18:14:15) Post Reply
Page 0 1 2 3 4 5

vladdrac
Need To Set


Enrolled: Dec 2003
Posts: 14
AP: 1

hahahaha i know have a migraine.

I cant seem to figure out the error in line 22, looks right to me




<HTML>
<HEAD>
<TITLE>Week 2</TITLE>
</HEAD>
<BODY>




<?php
//random website strings
$link0="<a href='http://www.dogpile.com>Dogpile</a>A Search Engine";
$link1="<a href='http://www.geocities.com/ruffryder23_2002'>Vladdrac World</a> My own site";
$link2="<a href='http://www.google.com'>Google</a>A popular search engine";
$link3="<a href='http://www.yahoo.com'>Yahoo</a>A popular search engine";
$link4="<a href='http://www.geocities.com'>Geocities</a>A free web host";
$link5="<a href='http://www.tripod.com'>Tripod</a>A free web host";
$link6="<a href='http://www.adlkfklj.com'>Crap</a>Not a real website";


//day of the week in number
$today=(date"w");

//code for the link of the day
<p>Today's Link is </p>
switch($today);
{
case 0:
print ("$link0");
break;
case 1:
print ("$link1");
break;
case 2:
print ("$link2");
break;
case 3:
print ("$link3");
break;
case 4:
print ("$link4");
break;
case 5:
print ("$link5");
break;
case 6:
print ("$link6");
break;
default:
print ("$link0");
}
?>

</BODY>
</HTML>




help?

 

 (#468 2004-01-13 18:35:38) Post Reply
Page 0 1 2 3 4 5

vladdrac
Need To Set


Enrolled: Dec 2003
Posts: 14
AP: 1

ok i figured it out, I guess from now on i should actually try to debug it myself before yelling for help. Damn, that means i have to think for myself?




<?php
//random website strings
$link0="<a href='http://www.dogpile.com>Dogpile</a> A Search Engine";
$link1="<a href='http://www.geocities.com/ruffryder23_2002'> Vladdrac World</a> My own site";
$link2="<a href='http://www.google.com'>Google</a> A popular search engine";
$link3="<a href='http://www.yahoo.com'>Yahoo</a> A popular search engine";
$link4="<a href='http://www.geocities.com'>Geocities</a> A free web host";
$link5="<a href='http://www.tripod.com'>Tripod</a> A free web host";
$link6="<a href='http://www.adlkfklj.com'>Crap</a> Not a real website";
$bl="todays featured link is ";
//day of the week in number
$today = date("w");
//code for the link of the day
switch($today)
{
case
0:
print (
"$bl $link0");
break;
case
1:
print (
"$bl $link1");
break;
case
2:
print (
"$bl $link2");
break;
case
3:
print (
"$bl $link3");
break;
case
4:
print (
"$bl $link4");
break;
case
5:
print (
"$bl $link5");
break;
case
6:
print (
"$bl $link6");
break;
default:
print (
"$bl $link0");
}
?>



 

 (#502 2004-02-10 08:56:06) Post Reply
Page 0 1 2 3 4 5

reaperx
Need To Set


Enrolled: Feb 2004
Posts: 4
AP: 1

Hi again ok took a pop at this one and it seams to work ok.



<HTML>
<HEAD>
<TITLE>assignment 2</TITLE>
</HEAD>
<BODY>
<?PHP
//Set date var
$date=date("w");
//Set site var
$Sun="<a href=\"http://www.ntlworld.com/\">NTL</a>";
$Mon="<a href=\"http://www.freeserve.com/\">Freeserve</a>";
$Tue="<a href=\"http://www.bt.com/\">BT</a>";
$Wed="<a href=\"http://www.microsoft.com/\">Microsoft</a>";
$Thu="<a href=\"http://www.yahoo.com/\">yahoo</a>";
$Fri="<a href=\"http://www.google.com/\">google/a>";
$Sat="<a href=\"http://www.bootdisk.com/\">bootdisk</a>";
//Switcher
switch ($date)
{
case
0:
print (
"Check out todays featured site: " . $Sun);
break;
case
1:
print (
"Check out todays featured site: " . $Mon);
break;
case
2:
print (
"Check out todays featured site: " . $Tue);
break;
case
3:
print (
"Check out todays featured site: " . $Wed);
break;
case
4:
print (
"Check out todays featured site: " . $Thu);
break;
case
5:
print (
"Check out todays featured site: " . $Fri);
break;
case
6:
print (
"Check out todays featured site: " . $Sat);
break;
}
/*I didnt use a default on the switcher, seamed a
bit redundent in this case days of the week being
constant, suppose a default would be used where a
case could be variable how many days in the month
for example ?? not sure with this anyone got any
clues ??? code works fine btw without default */
?>
</BODY>
</HTML>


 

 (#505 2004-02-11 03:19:56) Post Reply
Page 0 1 2 3 4 5

gunhoe86
Need To Set


Enrolled: Jan 2004
Posts: 1
AP: 1

i sort of altered what the script does to fit my own needs, but here it is never the less.



<?php

$today
= date("l");

$monday = "<img src="monday.jpg">";
$tuesday = "<img src="tuesday.jpg">";
$wednesday = "<img src="wednesday.jpg">";
$thursday = "<img src="thursday.jpg">";
$friday = "<img src="friday.jpg">";
$saturday = "<img src="saturday.jpg">";
$sunday = "<img src="sunday.jpg">";

switch(
$today)
{
case
0:
echo (
$monday);
break;

case
1:
echo (
$tuesday);
break;

case
2:
echo (
$wednesday);
break;

case
3:
echo (
$thursday);
break;

case
4:
echo (
$friday);
break;

case
5:
echo (
$saturday);
break;

case
6:
echo (
$sunday);
break;

default:
echo (
$friday);
}

?>




it worked like a charm where i used it

~JOSH

 

 (#513 2004-02-14 18:10:25) Post Reply
Page 0 1 2 3 4 5

nydud55
Need To Set


Enrolled: Feb 2004
Posts: 2
AP: 1



<html>

<head>
<title></title>
</head>

<body>

<?php

$today
=date("l");
$mlink="http://www.google.com";
$tlink="http://www.yahoo.com";

switch(
$today){
case
0:
echo(
today link is $mlink);
break;
case
1:
echo(
today link is $tlink);
break;
}
?>


</body>

</html>


this doesnt seem to be working

 

 (#515 2004-02-16 11:58:29) Post Reply
Page 0 1 2 3 4 5

smilingdog
Need To Set


Enrolled: Feb 2004
Posts: 3
AP: 1

Why am I getting a dump of all the strings?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<!-- Creation Date: <?=Date("d/m/Y")?> -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Dev-PHP 1.9.4">
<title>Document Title</title>
</head>
<body>
<?php
$today = date("w");
switch($today)
{
case "0":
print("The link for the day is: http://www.yahoo.com<br>");
case "1":
print("The link for the day is: http://www.google.com<br>");
case "2":
print("The link for the day is: http://www.altavista.com<br>");
case "3":
print("The link for the day is: http://www.excite.com<br>");
case "4":
print("The link for the day is: http://www.lycos.com<br>");
case "5":
print("The link for the day is: http://www.metacrawler.com<br>");
case "6":
print("The link for the day is: http://www.aol.com<br>");
}
?>
</body>
</html>

 

 (#516 2004-02-16 14:16:08) Post Reply
Page 0 1 2 3 4 5

Cyb
Need To Set


Enrolled: Feb 2004
Posts: 6
AP: 1

Maybe because you forgot the break; :)
Having a default is normally useful too to be sure it always works.

 

 (#517 2004-02-16 14:57:20) Post Reply
Page 0 1 2 3 4 5

smilingdog
Need To Set


Enrolled: Feb 2004
Posts: 3
AP: 1

Thanks for the help

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<!-- Creation Date: <?=Date("d/m/Y")?> -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Dev-PHP 1.9.4">
<title>Document Title</title>
</head>
<body>
<?php
$today = date("w");
switch($today)
{
case "0":
print("The link for the day is: http://www.yahoo.com<br>");
break;
case "1":
print("The link for the day is: http://www.google.com<br>");
break;
case "2":
print("The link for the day is: http://www.altavista.com<br>");
break;
case "3":
print("The link for the day is: http://www.excite.com<br>");
break;
case "4":
print("The link for the day is: http://www.lycos.com<br>");
break;
case "5":
print("The link for the day is: http://www.metacrawler.com<br>");
break;
case "6":
print("The link for the day is: http://www.aol.com<br>");
break;
default:
print("Today's link is: http://www.cnbc.com<br>");
}
?>
</body>
</html>

 

 (#519 2004-02-18 22:58:15) Post Reply
Page 0 1 2 3 4 5

ice52us
Need To Set


Enrolled: Feb 2004
Posts: 9
AP: 1

hi, i just started the assignment, but i do not understand why i have an error. please help

<?php
$desc1='yahoo'
$link1='?><a href:"www.yahoo.com"><script language="php">$desc1</script></a><?php ' ?>
<?php
date ("w");
if ("date == 0") { $link1 };
?>

 

 (#521 2004-02-19 10:19:42) Post Reply
Page 0 1 2 3 4 5

nymor
Need To Set


Enrolled: Feb 2004
Posts: 3
AP: 1

Here is my completion. However, the browser says something is wrong on line 29, and it expects 'T_DEFAULT'.

<html>
<head>
<title>
Week 2 Assignment
</title>
</head>
<body>
<?php
//This program prints one URL and link each day
//Get date of week, and assign it to a variable
$today = date("w");
//Assign URLs
$sulink = '<a href="http://www.LangMaker.com">LangMaker.com</a>';
$sudes = 'THE website for creating languages with resources, conlangs, scripts, and more!';
$molink = '<a href="http://www.google.com">Google.com Search Engine</a>';
$modes = 'Those who seek, find. And those who seek with Google find more!';
$tulink = '<a href="http://www.diarenye.net">Diarenye</a>';
$tudes = 'My website, with languages, quizzes, polls, and more!';
$welink = '<a href="http://www.awstage.org">Awstage.org</a>';
$wedes = 'Awstage.org is a non-profit theater company';
$thlink = '<a href="http://www.yahoo.com">Yahoo!</a>';
$thdes = 'A description?';
$frlink = '<a href="http://www.GMtFD.org">GMTFD.org</a>';
$frdes = 'Green Mountain Fife and Drum Corps.';
$salink = '<a href="http://rohan.diarenye.net">News from the North</a>';
$sades = 'A free on-line Tolkien Newsletter.';
// SWITCH
switch($today) {
case0:
print($sulink);
print($sudes);
break;
print($molink);
print($modes);
break;
print($tulink);
print($tudes);
break;
print($welink);
print($wedes);
break;
print($thlink);
print($thdes);
break;
print($frlink);
print($frdes);
break;
print($salink);
print($sades);
}
?>
</body>
</html>

 

 (#531 2004-02-29 01:27:35) Post Reply
Page 0 1 2 3 4 5

dwpreston
Need To Set


Enrolled: Feb 2004
Posts: 4
AP: 1

<TITLE>Script School Assignment 2</TITLE>
<center>

<?php
/*TO-DO ASSIGNMENT: Write a script to display a different URL each day of the week.

The Variables*
*/

$today =date("w");
$comment = "Todays URL is : ";
print "$today";
//Switch

switch($today)
{
case "0";
$url = "<a href=\"http://google.com\">Google </a><br>Great search engine";
break;
case "1";
$url = "<a href=\"http://yahoo.com/\">Yahoo</a><br>Very useful place";
break;
case "2";
$url = "<a href=\"http://www.php.net/\">PHP</a><br>The PHP Home Page";
break;
case "3";
$url = "<a href=\"http://www.prestons-tx.us/dwpreston\">Preston Homepage</a><br>My training ground";
break;
case "4";
$url = "<a href=\"http://www.adventurezoneelpaso.com\">Adventure Zone in El Paso, Texas</a><br>Where I earn my livelyhood";
break;
case "5";
$url = "<a href=\"http://www.chunkrockrecords\">Record Shop</a><br>Online Record Shop under construction.";
break;
case "6";
$url = "<a href=\"http://www.hotmail.com\">Hotmail</a><br>Free email site";
break;
}
Print "$comment $url";
?>



 

 (#532 2004-02-29 01:39:05) Post Reply
Page 0 1 2 3 4 5

dwpreston
Need To Set


Enrolled: Feb 2004
Posts: 4
AP: 1

<TITLE>Script School Assignment 2</TITLE>
<center>

<?code
/*TO-DO ASSIGNMENT: Write a script to display a different URL each day of the week.

The Variables*
*/

$today =date("w");
$comment = "Todays URL is : ";
print "$today";
//Switch

switch($today)
{
case "0";
$url = "<a href=\"http://google.com\">Google </a><br>Great search engine";
break;
case "1";
$url = "<a href=\"http://yahoo.com/\">Yahoo</a><br>Very useful place";
break;
case "2";
$url = "<a href=\"http://www.php.net/\">PHP</a><br>The PHP Home Page";
break;
case "3";
$url = "<a href=\"http://www.prestons-tx.us/dwpreston\">Preston Homepage</a><br>My training ground";
break;
case "4";
$url = "<a href=\"http://www.adventurezoneelpaso.com\">Adventure Zone in El Paso, Texas</a><br>Where I earn my livelyhood";
break;
case "5";
$url = "<a href=\"http://www.chunkrockrecords\">Record Shop</a><br>Online Record Shop under construction.";
break;
case "6";
$url = "<a href=\"http://www.hotmail.com\">Hotmail</a><br>Free email site";
break;
}
Print "$comment $url";

/
?>

 

 (#533 2004-02-29 01:40:44) Post Reply
Page 0 1 2 3 4 5

dwpreston
Need To Set


Enrolled: Feb 2004
Posts: 4
AP: 1

sorry for the double post but don't seem to be able to get the color feature to work what am i doing wrong ?

 

 (#534 2004-03-03 03:04:27) Post Reply
Page 0 1 2 3 4 5

slinky
Need To Set


Enrolled: Feb 2004
Posts: 7
AP: 1


<?php
//setting the date as a variable
$day = date("w")
//making the links variables
$l0 = "<a href="www.1.com>1.com</a>
$l1 = "<a href="www.1.com>1.com</a>
$l2 = "<a href="www.1.com>1.com</a>
$l3 = "<a href="www.1.com>1.com</a>
$l4 = "<a href="www.1.com>1.com</a>
$l5 = "<a href="www.1.com>1.com</a>
$l6 = "<a href="www.1.com>1.com</a>
//switch
switch($day)
{
case0:
print(
"todays link is $l0");
break;
case1:
print(
"todays link is $l1");
break;
case2:
print(
"todays link is $l2");
break;
case3:
print(
"todays link is $l3");
break;
case4:
print(
"todays link is $l4");
break;
case5:
print(
"todays link is $l5");
break;
case6:
print(
"todays link is $l6");
break;
default:
print(
"sorry but today isnt a day lol");
?>


 

 (#536 2004-03-03 19:01:21) Post Reply
Page 0 1 2 3 4 5

MSX
Need To Set


Enrolled: Mar 2004
Posts: 2
AP: 1

<?

// Define script's variables
$today = date("w");

// Starting the script
switch($today)
{
case"0":
$url = "<a href="http://zonedout.net">ZonedOut.net - My Site!</a>";
break;
case"1":
$url = "<a href="http://scriptschool.com">ScriptSchool.com - My PHP teacher!</a>";
break;
case"2":
$url = "<a href="http://ebay.com">eBay.com - Online Auctions!</a>";
break;
case"3":
$url = "<a href="http://hbo.com">HBO.com - HBO Website!</a>";
break;
case"4":
$url = "<a href="http://tutorialforums.com">TutorialForums.com - Great Tutorial Forum!</a>";
break;
case"5":
$url = "<a href="http://jokes.com">Jokes.com - Funny jokes online</a>";
break;
case"6":
$url = "<a href="http://espn.com">ESPN.com - All of the latest sports news online!</a>";
break;
default:
print("Please refresh the page, there was an error");
break;
}

print("Today's Link is - $url")
?>

And it work too, I have it setup locally on my PC...:).

 

 (#538 2004-03-03 23:43:20) Post Reply
Page 0 1 2 3 4 5

slinky
Need To Set


Enrolled: Feb 2004
Posts: 7
AP: 1


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Week 5 basic assignment</title>
</head>
<body>
<?php
$day
= date("w");
$SunL ="<a href=www.0.com>click here to visit the site of the day</a>"
$SunD ="todays link is 0.com"
$MonL ="<a href=www.1.com>click here to visit the site of the day</a>"
$Mond ="todays link is 1.com"
$TuesL ="<a href=www.2.com>click here to visit the site of the day</a>"
$TuesD ="todays link is 2.com"
$WedL ="<a href=www.3.com>click here to visit the site of the day</a>"
$WedD ="todays link is 3.com"
$ThursL ="<a href=www.4.com>click here to visit the site of the day</a>"
$ThursD ="todays link is 4.com"
$FridayL ="<a href=www.5.com>click here to visit the site of the day</a>"
$FridayD ="todays link is 5.com"
$SaturdayL ="<a href=www.6.com>click here to visit the site of the day</a>"
$SaturdayD ="todays link is 6.com"
{
switch(
$day);
case0:
echo(
"$SunD","$SunL");
break;
case1:
echo(
"$MonD","$MonL");
break;
case2:
echo(
"$TuesD","$TuesL");
break;
case3:
echo(
"$WedD","$WedL");
break;
case4:
echo(
"$ThursD","$ThursL");
break;
case5:
echo(
"$FridayD","$FridayL");
break;
case6:
echo(
"$SaturdayD","$SaturdayL");
break;
default:
echo(
"$SunD","$SunL");
?>

</body>
</html>




 

 (#558 2004-03-22 13:00:48) Post Reply
Page 0 1 2 3 4 5

Emdec
Need To Set


Enrolled: Mar 2004
Posts: 8
AP: 1



<html>
<head>
<title>Week 1</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">


<?

// find the day of week
$today = date("w");
$MyDay = date("l");

// set variables depending on day

switch($today)
{
case
0:
$MySite = "www.walesonline.com";
$MyTitle = "WalesOnline";
break;
case
1:
$MySite = "dvd.euroad.net";
$MyTitle = "DVD Wales";
break;
case
2:
$MySite = "best.walesonline.com";
$MyTitle = "Top Welsh Sites";
break;
case
3:
$MySite = "www.bookscymru.co.uk";
$MyTitle = "Bookscymru";
break;
case
4:
$MySite = "www.dunvant.org";
$MyTitle = "Dunvant Choir";
break;
case
5:
$MySite = "www.bplastics.com";
$MyTitle = "Building Plastics";
break;
case
6:
$MySite = "www.ourweb.org";
$MyTitle = "Watercolour World";
break;

default:
echo
"Time has run out !";
}

$MyMessage = " It is " . $MyDay . ". Lets go to <a href=\"http://";
$MyMessage = $MyMessage . $MySite . "\">" . $MyTitle . "</a>";

echo
$MyMessage ;

?>
</body>
</html>




 

 (#567 2004-03-27 19:11:12) Post Reply
Page 0 1 2 3 4 5

Technel
Need To Set


Enrolled: Mar 2004
Posts: 6
AP: 1

Here's my code:


<html>
<head>
<title>ScriptSchool Assignment #2</title>
</head>
<body>
<?php
// This script will display a different URL for each day of the week.
// Get numerical day of The link for week
$today = date("w");
// Assign URLs to variables
$day1 = "http://php.net";
$day1d = "PHP Manual";
$day2 = "http://cnn.com";
$day2d = "CNN News!";
$day3 = "http://nitrox.uni.cc";
$day3d = "My web site!";
$day4 = "http://scriptschool.com";
$day4d = "Online script school!";
$day5 = "http://windowsupdate.microsoft.com";
$day5d = "Microsoft Windows update.";
$day6 = "http://ebay.com";
$day6d = "Online auctions!";
$day7 = "http://thinkgeek.com";
$day7d = "Thinkgeek clothing!";
// Switch!
switch($today) {
case
0:
print (
"Today's link is: $day1<br>$day1d");
break;
case
1:
print (
"Today's link is: $day2<br>$day2d");
break;
case
2:
print (
"Today's link is: $day3<br>$day3d");
break;
case
3:
print (
"Today's link is: $day4<br>$day4d");
break;
case
4:
print (
"Today's link is: $day5<br>$day5d");
break;
case
5:
print (
"Today's link is: $day6<br>$day6d");
break;
print (
"Today's link is: $day7<br>$day7d");
default:
print (
"Error!");
}
?>
</body>
</html>


 

 (#570 2004-03-28 22:01:02) Post Reply
Page 0 1 2 3 4 5

infinull
Need To Set


Enrolled: Mar 2004
Posts: 2
AP: 1

This is my week two assignment
why does PHP have to parse single and double quote strings differently.
It annoys me, but it hwlped me this case.


<html>
<head>
<title>cool</title>
</head>
<body>
<?php
/*
TO-DO ASSIGNMENT #2: Write a script to print to the browser a different URL
each day of the week using the switch/case statement and comparing to the
numeric day of the week (0-6), not the textual (Sunday-Saturday) day of the week.
Use only one print() function to do this and make these urls active hyperlinks
with the url title hyperlinked and the url description not hyperlinked.
Employ the use of concatenation to create the single print function instead
of enclosing in interpreted double quotes to demonstrate your understanding
of concatenating strings. Cut and paste your code to the Week 2 forum to share
with others in the appropriate "To-do Assignment #2" folder.
*/

$today = 0;
switch(
$today) {
case
0:
$url ="http://www.google.com";
$title = "Google";
$desc = " The Most Used Search Engine";
break;
case
1:
$url ="http://www.yahoo.com";
$title = "Yahoo!!!!!";
$desc = "Has better Mail than Search \n Oh well";
break;
case
2:
$url ="http://www.altavista.com";
$title = "AltaVista";
$desc = "Good Translator";
break;
case
3:
$url ="http://www.dogpile.com";
$title = "Dogpile";
$desc = "Searches everything";
break;
case
4:
$url ="http://www.ask.com";
$title = "Ask Jeeves";
$desc = "Ask your personal butler a question";
break;
case
5:
$url ="http://www.mamma.com";
$title = "Mamma Metasearch";
$desc = "The mother of all Searches";
break;
case
6:
$url ="http://www.lycos.com";
$title = "Lycos";
$desc = "old slogan was: go get it";
break;
default:
$url ="http://www.google.com";
$title = "Google";
$desc = " The Most Used Search Engine";
break;
}

print(
'The weekly search engine is <a href="'.$url.'">'.$title."</a><br/> \n");
print(
$desc);
?>
</body>


 

 (#573 2004-04-05 21:31:08) Post Reply
Page 0 1 2 3 4 5

enshoku
Need To Set


Enrolled: Apr 2004
Posts: 3
AP: 1

It appears to work.

===============================


<html>
<head>
<title>Welcome to the Daily Link Switchfest!!!</title>
</head>
<body bgcolor = "red">
<font color ="white">
<b>
<?

/* TO-DO ASSIGNMENT #2: Write a script to print to the
browser a different URL each day of the week using
the switch/case statement and comparing to the numeric
day of the week (0-6), not the textual (Sunday-Saturday)
day of the week. Use only one print() function to do
this and make these urls active hyperlinks with the url
title hyperlinked and the url description not hyperlinked.
Employ the use of concatenation to create the single print
function instead of enclosing in interpreted double quotes
to demonstrate your understanding of concatenating strings.
Cut and paste your code to the Week 2 forum to share with
others in the appropriate "To-do Assignment #2" folder.
*/




// Declare variables

$wrds = "My favorite link for today is: ";
$date = date("w");
$link0 = "<a href=\"http://www.cutiepieflygirl.netfirms.com\"> A real Cutie Pie!</a>";
$link1 = "<a href=\"http://www.joecartoon.com> Sadistically Funny!</a>";
$link2 = "<a href=\"http://www.cutiepieflygirl.netfirms.com\"> A real Cutie Pie!</a>";
$link3 = "<a href=\"http://www.jokes.com\">Warning: Jokes will make you laugh!</a>";
$link4 = "<a href=\"http://www.nfl.com\">Football at it's greedy best!</a>";
$link5 = "<a href=\"http://www.nba.com\">I just love tall sweaty men!</a>";
$link6 = "<a href=\"http://www.nhl.com\">It's Hockey. Enough said.</a>";

// Tell what to display on a given day

switch($date)
{
case
0:
print (
"$wrds $link0");
break;

case
1:
print (
"$wrds $link1");
break;

case
2:
print (
"$wrds $link2");
break;

case
3:
print(
"$wrds $link3");
break;

case
4:
print(
"$wrds $link4");
break;

case
5:
print(
"$wrds $link4");
break;

case
6:
print(
"$wrds $link4");
break;

}

php?>
</b>
</font>
</body>
</html>


 

 (#574 2004-04-05 21:33:31) Post Reply
Page 0 1 2 3 4 5

enshoku
Need To Set


Enrolled: Apr 2004
Posts: 3
AP: 1

I had a typo in my earlier post, but now I got it covered. *blushes*
-----------




<html>
<head>
<title>Welcome to the Daily Link Switchfest!!!</title>
</head>
<body bgcolor = "red">
<font color ="white">
<b>
<?

/* TO-DO ASSIGNMENT #2: Write a script to print to the
browser a different URL each day of the week using
the switch/case statement and comparing to the numeric
day of the week (0-6), not the textual (Sunday-Saturday)
day of the week. Use only one print() function to do
this and make these urls active hyperlinks with the url
title hyperlinked and the url description not hyperlinked.
Employ the use of concatenation to create the single print
function instead of enclosing in interpreted double quotes
to demonstrate your understanding of concatenating strings.
Cut and paste your code to the Week 2 forum to share with
others in the appropriate "To-do Assignment #2" folder.
*/




// Declare variables

$wrds = "My favorite link for today is: ";
$date = date("w");
$link0 = "<a href=\"http://www.cutiepieflygirl.netfirms.com\"> A real Cutie Pie!</a>";
$link1 = "<a href=\"http://www.joecartoon.com> Sadistically Funny!</a>";
$link2 = "<a href=\"http://www.cutiepieflygirl.netfirms.com\"> A real Cutie Pie!</a>";
$link3 = "<a href=\"http://www.jokes.com\">Warning: Jokes will make you laugh!</a>";
$link4 = "<a href=\"http://www.nfl.com\">Football at it's greedy best!</a>";
$link5 = "<a href=\"http://www.nba.com\">I just love tall sweaty men!</a>";
$link6 = "<a href=\"http://www.nhl.com\">It's Hockey. Enough said.</a>";

// Tell what to display on a given day

switch($date)
{
case
0:
print (
"$wrds $link0");
break;

case
1:
print (
"$wrds $link1");
break;

case
2:
print (
"$wrds $link2");
break;

case
3:
print(
"$wrds $link3");
break;

case
4:
print(
"$wrds $link4");
break;

case
5:
print(
"$wrds $link5");
break;

case
6:
print(
"$wrds $link6");
break;

}

php?>
</b>
</font>
</body>
</html>



 

 (#578 2004-04-10 05:16:28) Post Reply
Page 0 1 2 3 4 5

lklint
Need To Set


Enrolled: Apr 2004
Posts: 3
AP: 1



<html>

<head>
<title>URL of the day</title>
</head>
<body>
<?php
//First I set todays day as a number between 0 and 6
$today = date("w");
//Then I switch between the different URLs according to the day
switch($today)
{
//If today is Sunday
case "0":
//Set url of the day
$urloftheday = "http://www.bt.dk";
//Brief description of the site of the day
$urldescription = "a Danish newspaper";
//Break out of the switch if the day is equal to $today
break;
case
"1":
$urloftheday = "http://www.alltooflat.com";
$urldescription = "a site for strange things (and people)";
break;
case
"2":
$urloftheday = "http://www.alltooflat.com/geeky/elgoog/";
$urldescription = "a Google mirror site";
break;
case
"3":
$urloftheday = "http://home.zylstra.com/comedy/weird/pranks.html";
$urldescription = "for when you get bored";
break;
case
"4":
$urloftheday = "http://www.google.com";
$urldescription = "the most efficient search engine";
break;
case
"5":
$urloftheday = "http://www.eb.dk";
$urldescription = "a Danish newpaper";
break;
case
"6":
$urloftheday = "http://www.thestrangesite.com/";
$urldescription = "the strange site";
break;
//If none of the cases above are true, there is something wrong with the server date
default:
$urloftheday = "not available due to a server error";
$urldescription = "a server error";
}
//Print to screen the day, site of the day and the description as set by the switch function
print("Today is ".date("l")." and the site of the day is <a href='".$urloftheday."'>".$urloftheday."</a>. It is ".$urldescription.".");
?>
</body>
</html>



Hi everybody.
Here's my code for week 2. Any comments are appreciated. :-)

Lars

 

 (#587 2004-04-25 15:42:29) Post Reply
Page 0 1 2 3 4 5

wilde1000
Need To Set


Enrolled: Apr 2004
Posts: 3
AP: 1

<?
/*Second week assignment - Write a script to print to the browser a different URL each day of the week using the

switch/case statement and comparing to the numeric day of the week (0-6), not the textual (Sunday-Saturday) day of

the week. Use only one print() function to do this and make these urls active hyperlinks with the url title

hyperlinked and the url description not hyperlinked. Employ the use of concatenation to create the single print

function instead of enclosing in interpreted double quotes to demonstrate your understanding of concatenating

strings. */
/*Set the $today variable to the proper fomat*/
$today=date("w");
$today_text=date("l");//needed for print format
/*Set other print variables*/
$introduction="Welcome, today is ";
/*Establish the remaining print variables*/
switch($today)
{
case 0:
$url_text=" -- Check out Google for searching ";
?>
<A HREF=http://www.google.com>Google</A><BR>
<?
break;
case 1:
$url_text=" -- Check out CNN for news ";
?>
<A HREF=http://www.cnn.com>CNN</A><BR>
<?
break;
case 2:
$url_text=" -- Check out Yahoo for games ";
?>
<A HREF=http://www.yahoo.com>Yahoo</A><BR>
<?
break;
case 3:
$url_text=" -- Check out Pogo for games ";
?>
<A HREF=http://www.pogo.com>Pogo</A><BR>
<?
break;
case 4:
$url_text=" -- Check out ZDNet for downloads ";
?>
<A HREF=http://www.zdnet.com>ZDNet</A><BR>
<?
break;
case 5:
$url_text=" -- Check out PHP for php scripts ";
?>
<A HREF=http://www.php.com>PHP</A><BR>
<?
break;
default:
$url_text=" -- Check out Sportline for sports news ";
?>
<A HREF=http://www.sportsline.com>Sportsline</A><BR>
<?
break;
}
/*using one Print statement.......*/
Print($introduction.$today_text.$url_text);
*/Have tested script and checked it against assignment requirements
?>

 

 (#588 2004-04-25 18:04:09) Post Reply
Page 0 1 2 3 4 5

wilde1000
Need To Set


Enrolled: Apr 2004
Posts: 3
AP: 1

<?
/*Second week assignment - Write a script to print to the browser a different URL each day of the week using the

switch/case statement and comparing to the numeric day of the week (0-6), not the textual (Sunday-Saturday) day of

the week. Use only one print() function to do this and make these urls active hyperlinks with the url title

hyperlinked and the url description not hyperlinked. Employ the use of concatenation to create the single print

function instead of enclosing in interpreted double quotes to demonstrate your understanding of concatenating

strings. */
/*Set the $today variable to the proper fomat*/
$today=date("w");
$today_text=date("l");//needed for print format
/*Set other print variables*/
$introduction="Welcome, today is ";
/*Establish the remaining print variables*/
switch($today)
{
case 0:
$url_text=" -- Check out Google for searching ";
?>
<A HREF=http://www.google.com>Google</A><BR>
<?
break;
case 1:
$url_text=" -- Check out CNN for news ";
?>
<A HREF=http://www.cnn.com>CNN</A><BR>
<?
break;
case 2:
$url_text=" -- Check out Yahoo for games ";
?>
<A HREF=http://www.yahoo.com>Yahoo</A><BR>
<?
break;
case 3:
$url_text=" -- Check out Pogo for games ";
?>
<A HREF=http://www.pogo.com>Pogo</A><BR>
<?
break;
case 4:
$url_text=" -- Check out ZDNet for downloads ";
?>
<A HREF=http://www.zdnet.com>ZDNet</A><BR>
<?
break;
case 5:
$url_text=" -- Check out PHP for php scripts ";
?>
<A HREF=http://www.php.com>PHP</A><BR>
<?
break;
default:
$url_text=" -- Check out Sportline for sports news ";
?>
<A HREF=http://www.sportsline.com>Sportsline</A><BR>
<?
break;
}
/*using one Print statement.......*/
Print($introduction.$today_text.$url_text);
*/Have tested script and checked it against assignment requirements
?>

 

 (#589 2004-05-01 16:44:07) Post Reply
Page 0 1 2 3 4 5

Helena
Need To Set


Enrolled: Apr 2004
Posts: 3
AP: 1

<?
//Find the day of week

$today = date ("w");
$MyDay = Date (" l");

//set variables depending on day

switch($today)
{
case 0://sunday
$MySite = "http://www.eurotropic.com/beachfrontapartment/beachfront_apt.htm";
$MyTitle = "This is a wonderful place to spend a holiday";
break;
case 1://monday
$MySite = "http://www.eurotropic.com/edificiopropisa/apartpropisa.htm";
$MyTitle = "This is the best unspoilt place on the southern coast...";
break;
case 2://tuesday
$MySite = "http://www.eurotropic.com/villavictoria/villavictoria.htm";
$MyTitle= "Just see this apartment.......";
break;
case 3://wednesday
$MySite = "http://www.eurotropic.com/saliega/villasaliega.htm";
$MyTitle ="Today's link for a lovely villa.....";
break;
case 4://thursday
$MySite = "http://www.eurotropic.com/book/north.htm";
$MyTitle = "Something to read...";
break;
case 5://friday
$MySite = "http://www.alhambra-patronato.es/ingles/inforgenrl/informain.htm";
$MyTitle = "Take a trip to Granada and visit the Alhambra....";
break;
case 6://saturday
$MySite = "www.eurotropic.com";
$MyTitle = "Your holiday site...";
break;
default:
echo "Time has run out !";
}
$MyMessage = "It is" . $MyDay . "<br> Lets go to .... <a href="http://";
$MyMessage = $MyMessage .$MySite ."">" . $MyTitle ." </a>";

echo $MyMessage;
?>


It works!!!

 

 (#591 2004-05-20 13:57:03) Post Reply
Page 0 1 2 3 4 5

Beauchy
Need To Set


Enrolled: May 2004
Posts: 5
AP: 1



<html>
<title>PHP Assignment 2</title>
<body>
<?php
// assign URL and discriptions to variables
$today= date(w);
$sunlink = ("<a href ='http://www.ri.gov'>http://www.ri.gov</a>");
$sundisc = ("RI state government portal");
$monlink = ("<a href ='http://www.drudgereport.com'>http://www.drudgereport.com</a>");
$mondisc = ("Good news linking site");
$tueslink = ("<a href ='http://www.riema.ri.gov'>http://www.riema.ri.gov</a>");
$tuesdisc = ("My site created for RIEMA");
$wedlink = ("<a href ='http://www.cox.com'>http://www.cox.com</a>");
$weddisc = ("My ISP");
$thurlink = ("<a href ='http://www.scriptschool.com'>http://www.scriptschool.com</a>");
$thurdisc = ("Great learning site, thanks!");
$frilink = ("<a href ='www.espn.com'>http://www.espn.com</a>");
$fridisc = ("Da, da, da! Da, da, da!");
$satlink = ("<a href ='www.msnbc.com'>http://www.msnbc.com</a>");
$satdisc = ("National news on the web");
// assign print information to the corresponding day
switch ($today){
case
0:
$printInfo = ($sunlink . "<br>" . $sundisc);
break;
case
1:
$printInfo = ($monlink . "<br>" . $mondisc);
break;
case
2:
$printInfo = ($tueslink . "<br>" . $tuesdisc);
break;
case
3:
$printInfo = ($wedlink . "<br>" . $weddisc);
break;
case
4:
$printInfo = ($thurlink . "<br>" . $thurdisc);
break;
case
5:
$printInfo = ($frilink . "<br>" . $fridisc);
break;
case
6:
$printInfo = ($satlink . "<br>" . $satdisc);
break;
}
// single print statement
print($printInfo);
?>
</body>
</html>


 

 (#597 2004-05-25 13:54:41) Post Reply
Page 0 1 2 3 4 5

madhatter
Need To Set


Enrolled: May 2004
Posts: 10
AP: 1



<html>
<head>
<title>Untitled Document</title>

</head>

<body>
<?php
//assigning a different url for every day of the week
//set the function to display current date
$date = date("l,F j,Y");
//set the function to get the date in numerical form for switch
$day = date("w");
//set the links for everyday
$monday = "Mid America Trucking Show at <a href=\"http://www.truckingshow.com\">www.truckingshow.com</a>";
$tuesday = "Scriptschool, the best scripting school on the net at <a href=\"http://www.scriptschool.com\">www.scriptschool.com</a>";
$wednesday = "Webmonkey has some good information, check it out at <a href=\"http://www.webmonkey.com\">www.webmonkey.com</a>";
$thursday = "Stay up to date on HTML standards at the <a href=\"http://www.w3c.com\">world wide web consortium site</a>";
$friday = "Find more good tutorials at <a href=\"http://www.w3schools.com\">W3schools.com</a>";
$saturday = "To get an easy setup of apache,mysql,and php, go to <a href=\"http://www.foxserv.net\">Foxserv</a>";
$sunday = "Need a good php book? Check out <