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

 

 (#741 2004-11-15 12:48:32) Post Reply
Page 0 1 2 3 4 5

FamYon
Need To Set


Enrolled: Nov 2004
Posts: 3
AP: 1

Yes I noticed that I changed it from case0 to case 0. Thanks for pickup :-)

FamYon

 

 (#747 2004-12-08 15:14:35) Post Reply
Page 0 1 2 3 4 5

jcast
Need To Set


Enrolled: Dec 2004
Posts: 3
AP: 1

All right, everyone!

Here's week 2's assignment. Php doesn't seem to have a problem with it,
but I anxiously await your feedback. :)



<html>
<head>
<title>Test Link of the Day PHP Program</title>
</head>
<body>
<script language="php">
/* This is a test PHP program that will look at a variable which will
* indicate which day of the week it is and display a different URL for
* each day. */

// Variable containing day of the week as a word.
$dayw=date("l");

// Variable containing numeric day of the week (0-6 starting with Sun).
$dayn=date("w");

/* The next 14 variables will store each day's link and each day's
* link's description. Variable names should be self-explanatory, but
* then again... :-) */
$sunlink="<a href=\"http://www.google.com/\">";
$sundesc="Google</a> -- A Search engine <br />";
$monlink="<a href=\"http://www.coffee-anyone.com/\">";
$mondesc="Coffee anyone?</a><br />";
$tuelink="<a href=\"http://www.cnet.com/\">";
$tuedesc="CNET.com</a> -- Get your tech buzz.<br />";
$wedlink="<a href=\"http://www.southwest.com/\">";
$weddesc="Southwest Airlines</a> -- Let's get away from it all!<br />";
$thulink="<a href=\"http://www.noaa.gov/\">";
$thudesc="NOAA Weather</a> -- Your ultimate weather source";
$frilink="<a href=\"http://www.phonecoinc.com/\">";
$fridesc="PhoneCo INC.</a> -- Awesome antique and vintage phone
equipment<br />"
;
$satlink="<a href=\"http://www.ctnow.com/\">";
$satdesc="CT News and Events</a> -- Plan for a fun weekend.<br />";

// Variable to store greeting text
$greeting="
<h1>Hello and Welcome!</h1>
<p>Here is the link of the day for $dayw: "
;

// Using switch / case instead of if / then / else statements.
switch($dayn)
{

// If the day is Sunday, display Sunday's link and description.
case "0":
print (
"$greeting$sunlink$sundesc");
break;

// If the day is Monday, display Monday's link and description.
case "1":
print (
"$greeting Something we can all use $dayw morning --
$monlink$mondesc"
);
break;

// If the day is Tuesday, display Tuesday's link and description.
case "2":
print (
"$greeting$tuelink$tuedesc");
break;

// If the day is Wednesday, display Wednesday's link and description.
case "3":
print (
"$greeting$wedlink$weddesc");
break;

// If the day is Thursday, display Thursday's link and description.
case "4":
print (
"$greeting$thulink$thudesc");
break;

// If the day is Friday, print Friday's link and description.
case "5":
print (
"$greeting$frilink$fridesc");
break;

// If the day is Saturday, print Saturday's link and description.
default:
print (
"$greeting$satlink$satdesc");
}
</script>
</p>
</body>
</html>


 

 (#750 2004-12-11 22:26:20) Post Reply
Page 0 1 2 3 4 5

Aktar
Need To Set


Enrolled: Dec 2004
Posts: 5
AP: 1


<?
$today=(date("w")); //day variable in numbers
Switch($today)
{
case 0: $url=("<a href=\"http://www.google.com\"</a>Go

Gooooooooogle");
case 1: $url=("<a href=\"http://www.mail.yahoo.co.uk.com\"</a>Yahoo

Mail");
case 2: $url=("<p><a href=\"http://www.ebay.co.uk\"</a>E Bay Online

Market");
case 3: $url=("<a href=\"http://www.Javascriptsource.com\"</a>Java

Script Source");
case 4: $url=("<a href=\"http://www.Macromedia.com\"</a>Macromedia");
case 5: $url=("<a href=\"http://www.BBC.co.uk\"</a>BBC");
case 6: $url=("<a href=\"http://www.Nastyrat.com\"</a>Oooo Don't let

the kids catch you red handed");
print("Todays website on the menu is : $url");
}

//my note: for some reason I cannot use 'break'. the page doen't load

up wen i do
//eg [case 4: $url=("<a

href=\"http://www.Macromedia.com\"</a>Macromedia"); break;]
//default not used as the day for the 'default' will never come (so

sad)
?>

 

 (#751 2004-12-11 22:28:48) Post Reply
Page 0 1 2 3 4 5

Aktar
Need To Set


Enrolled: Dec 2004
Posts: 5
AP: 1

am i doing something wrong? how my text comes up big and ugly here?

 

 (#767 2005-02-18 13:17:10) Post Reply
Page 0 1 2 3 4 5

LowenWolfe
Need To Set


Enrolled: Feb 2005
Posts: 7
AP: 1

Here is my script ... better documentation than week 1's ;)



<?
// Assign number to day of week
$today_test = date("w");
// Assign text to day of week for display purposes
$today_show = date("l");
// Set URL base for web pages
$URL_base = "http://sandbox.buynowshop.com/";
// Test for day of week and assign URL
switch($today_test)
{
case
"0":
{
$URL = "sunday.htm";
break;
}
case
"1":
{
$URL = "monday.htm";
break;
}
case
"2":
{
$URL = "tuesday.htm";
break;
}
case
"3":
{
$URL = "wednesday.htm";
break;
}
case
"4":
{
$URL = "thursday.htm";
break;
}
case
"5":
{
$URL = "friday.htm";
break;
}
default:
// Use default for case "6" as there will be no other options
$URL = "saturday.htm";
}
// Display results
print ("Today is $today_show.");
print (
"<br>Please visit our page of the week <a href=" . $URL_base . $URL . ">here</a>");
?>




LowenWolfe

 

 (#774 2005-03-06 10:39:35) Post Reply
Page 0 1 2 3 4 5

zman
Need To Set


Enrolled: Feb 2005
Posts: 15
AP: 1

My Assignment #2:



<html>
<head>
<title>ScriptSchool.com Assignment 2</title>
</head>
<body bgcolor="666666">

<?php
/* ScriptSchool.Com Assignment 2
Description of 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.*/
print("<center><p><b>ScriptSchool.Com Assignment 2</b><br />
Description of Assignment: Write a script to print to the browser a<br />
different URL each day of the week using the switch/case statement<br />
and comparing to the numeric day of the week (0-6), not the textual<br />
(Sunday-Saturday) day of the week. Use only one print() function to<br />
do this and make these urls active hyperlinks with the url title<br />
hyperlinked and the url description not hyperlinked. Employ the use<br />
of concatenation to create the single print function instead of<br />
enclosing in interpreted double quotes to demonstrate your<br />
understanding of concatenating strings.</p>"
);

//Assignment of variables
$today = date("w");

switch(
$today)
{
case
"0";
$url = "http://www.sunday.com";
$url_title = "Sunday.com";
$url_desc = "Sunday is the day named after the Sun. Everything you ever wanted to know about Sunday and more is covered in extreme depth on this site.";
break;
case
"1";
$url = "http://www.monday.com";
$url_title = "Monday.com";
$url_desc = "Monday was once known of as Moonday. It is the day of celebrating the moon. If it is about Monday, it is covered on this site.";
break;
case
"2";
$url = "http://www.tuesday.com";
$url_title = "Tuesday.com";
$url_desc = "Tuesday.com. Because there is never anything else worth doing on Tuesdays,";
break;
case
"3";
$url = "http://www.wednesday.com";
$url_title = "Wednesday.com";
$url_desc = "Wednesday.com. Because Wednesday is hump day, this is a seite dedicated to planning for the weekend.";
break;
case
"4";
$url = "http://www.thursday.com";
$url_title = "Thursday.com";
$url_desc = "Thursday is a great night to watch British comedy on BBAmerica, so everything needed to schedule your evening in advance is provided here";
break;
case
"5";
$url = "http://www.friday.com";
$url_title = "Friday.com";
$url_desc = "There is nothing on Friday.com, except a link to Tuesday.com, since you are far too busy enjoying the beginngin of the weekend to waste your time here!";
break;
case
"6";
$url = "http://www.saturday.com";
$url_title = "Saturday.com";
$url_desc = "Saturday.Com is devoted to various day off activities, such as fishing, and catching up on a weeks worth of recordings on TiVo.";
break;
}

// Output results
print("<center><h2>Website of the day</h2><p><a href=\"".$url."\" target=\"_blank\">".$url_title."</a> - ".$url_desc.".</p></center>");

?>
</body>
</html>


 

 (#793 2005-03-25 21:11:46) Post Reply
Page 0 1 2 3 4 5

irunat2am
Need To Set


Enrolled: Mar 2005
Posts: 6
AP: 1



<html>
<body>
<p align="center">
<?php

$today
= date("w"); //The day in numerical format 0-6.
$tday = date("l"); //The day Sunday-Saturday
$tomorrow = "Come back tomorrow and we'll have a new link for you!";

//daily url
$su = "<a href='http://www.mghstudios.com'>Mghstudios</a>";
$mo = "<a href='http://www.google.com'>Google</a>";
$tu = "<a href='http://www.yahoo.com'>Yahoo</a>";
$we = "<a href='http://www.2advanced.com'>2advanced</a>";
$th = "<a href='http://www.theonion.com'>The Onion</a>";
$fr = "<a href='http://www.gprime.net'>Gprime</a>";
$sa = "<a href='http://www.pdx.edu'>Portland State University</a>";

//switch
switch($today)
{
case
"0":
$url = $su;
break;
case
"1":
$url = $mo;
break;
case
"2":
$url = $tu;
break;
case
"3":
$url = $we;
break;
case
"4":
$url = $th;
break;
case
"5":
$url = $fr;
break;
case
"6":
$url = $sa;
break;
default:
print
"sorry..but there is something wrong with this crap!";
}
print
"Hey! The Cool Link For <b>$tday</b> is: $url . $tomorrow";
?>
</body>
</html>
[code
<br>br>Live Demo: <a href="http://www.mghstudios.com/phptesting/test2.php">Week 2</a>


 

 (#794 2005-03-25 21:12:41) Post Reply
Page 0 1 2 3 4 5

irunat2am
Need To Set


Enrolled: Mar 2005
Posts: 6
AP: 1



<html>
<body>
<p align="center">
<?php

$today
= date("w"); //The day in numerical format 0-6.
$tday = date("l"); //The day Sunday-Saturday
$tomorrow = "Come back tomorrow and we'll have a new link for you!";

//daily url
$su = "<a href='http://www.mghstudios.com'>Mghstudios</a>";
$mo = "<a href='http://www.google.com'>Google</a>";
$tu = "<a href='http://www.yahoo.com'>Yahoo</a>";
$we = "<a href='http://www.2advanced.com'>2advanced</a>";
$th = "<a href='http://www.theonion.com'>The Onion</a>";
$fr = "<a href='http://www.gprime.net'>Gprime</a>";
$sa = "<a href='http://www.pdx.edu'>Portland State University</a>";

//switch
switch($today)
{
case
"0":
$url = $su;
break;
case
"1":
$url = $mo;
break;
case
"2":
$url = $tu;
break;
case
"3":
$url = $we;
break;
case
"4":
$url = $th;
break;
case
"5":
$url = $fr;
break;
case
"6":
$url = $sa;
break;
default:
print
"sorry..but there is something wrong with this crap!";
}
print
"Hey! The Cool Link For <b>$tday</b> is: $url . $tomorrow";
?>
</body>
</html>
[code
<br>br>Live Demo: <a href="http://www.mghstudios.com/phptesting/test2.php">Week 2</a>


 

 (#795 2005-03-25 21:15:17) Post Reply
Page 0 1 2 3 4 5

irunat2am
Need To Set


Enrolled: Mar 2005
Posts: 6
AP: 1

Please erase the previous 2 posts of mine..browser freaked out.



<html>
<body>
<p align="center">
<?php

$today
= date("w"); //The day in numerical format 0-6.
$tday = date("l"); //The day Sunday-Saturday
$tomorrow = "Come back tomorrow and we'll have a new link for you!";

//daily url
$su = "<a href='http://www.mghstudios.com'>Mghstudios</a>";
$mo = "<a href='http://www.google.com'>Google</a>";
$tu = "<a href='http://www.yahoo.com'>Yahoo</a>";
$we = "<a href='http://www.2advanced.com'>2advanced</a>";
$th = "<a href='http://www.theonion.com'>The Onion</a>";
$fr = "<a href='http://www.gprime.net'>Gprime</a>";
$sa = "<a href='http://www.pdx.edu'>Portland State University</a>";

//switch
switch($today)
{
case
"0":
$url = $su;
break;
case
"1":
$url = $mo;
break;
case
"2":
$url = $tu;
break;
case
"3":
$url = $we;
break;
case
"4":
$url = $th;
break;
case
"5":
$url = $fr;
break;
case
"6":
$url = $sa;
break;
default:
print
"sorry..but there is something wrong with this crap!";
}
print
"Hey! The Cool Link For <b>$tday</b> is: $url . $tomorrow";
?>
</body>
</html>


<br><br>Live Demo: <a href="http://www.mghstudios.com/phptesting/test2.php">Week 2</a>

 

 (#799 2005-04-06 18:43:12) Post Reply
Page 0 1 2 3 4 5

N8miah
Need To Set


Enrolled: Apr 2005
Posts: 2
AP: 1

<html>
<head>
<title>Assignment 2</title>
</head>
<body>
<?PHP

//This will assign the variable the numerical day of the week
$today=date("w");
//Urls and rest of code
$googlevar="<a href = http://www.google.com>Google</a>";
$msnvar="<a href = http://www.msn.com>MSN</a>";
$yahoovar="<a href = http://www.yahoo.com>Yahoo</a>";
$slashvar="<a href = http://slashdot.org>Slashdot</a>";
$phpvar="<a href = http://www.php.net>PHP</a>";
$ebayvar="<a href = http://www.ebay.com>e-bay</a>";
$scriptvar="<a href = http://www.scriptschool.com>Script School</a>";

//Use of Switch
switch($today){
case 0:
print("The link of the day is: $googlevar");
break;
case 1:
print("This link of the day is: $msnvar");
break;
case 2:
print("The link of the day is: $yahoovar");
break;
case 3:
print("The link of the day is: $slashvar");
break;
case 4:
print("The link of the day is: $phpvar");
break;
case 5:
print("The link of the day is: $ebayvar");
break;
case 6:
print("The link of the day is: $scriptvar");
break;
default:
print("Wrong code");
}
?>

</body>
</html>

 

 (#805 2005-04-22 01:19:04) Post Reply
Page 0 1 2 3 4 5

michaelp
Need To Set


Enrolled: Apr 2005
Posts: 4
AP: 1

I used images instead of links
however it will not print i just get blank screen not even source code. I tryed the print with and without the ()
<? #get the day
$today= (date("w"));
$imgpath=("../images")
?>

<?
switch ($today){
case
"0" :
break;
print (
" <img src=\"$imgpath/icon-date.gif\">");
case
1:
break;
print (
" <img src=\"$imgpath/icon-banner-html-d.gif\">");
case
2:
break;
print (
" <img src=\"$imgpath/help.gif\">");
case
3:
break;
print(
" <img src=\"$imgpath/icon-banner-new.gif\">");
case
4:
break;
print (
" <img src=\"$imgpath/error.gif\">");
case
5:
break;
print (
" <img src=\"$imgpath/0-chapter.gif\">");
case
6:
break;
print (
" <img src=\"$imgpath/0-bookopen.gif\">");
default;
print
"this is default";
}
?>


 

 (#806 2005-04-22 01:33:43) Post Reply
Page 0 1 2 3 4 5

michaelp
Need To Set


Enrolled: Apr 2005
Posts: 4
AP: 1

I used images instead of links
however it will not print i just get blank screen not even source code. I tryed the print with and without the ()
<? #get the day
$today= (date("w"));
$imgpath=("../images")
?>

<?
switch ($today){
case
"0" :
break;
print (
" <img src=\"$imgpath/icon-date.gif\">");
case
1:
break;
print (
" <img src=\"$imgpath/icon-banner-html-d.gif\">");
case
2:
break;
print (
" <img src=\"$imgpath/help.gif\">");
case
3:
break;
print(
" <img src=\"$imgpath/icon-banner-new.gif\">");
case
4:
break;
print (
" <img src=\"$imgpath/error.gif\">");
case
5:
break;
print (
" <img src=\"$imgpath/0-chapter.gif\">");
case
6:
break;
print (
" <img src=\"$imgpath/0-bookopen.gif\">");
default;
print
"this is default";
}
?>


 

 (#808 2005-04-25 11:58:32) Post Reply
Page 0 1 2 3 4 5

vegyta2004
Need To Set


Enrolled: Apr 2005
Posts: 34
AP: 1

I have a problem.
I don't understand the swich,case syntax

 

 (#810 2005-05-01 08:19:27) Post Reply
Page 0 1 2 3 4 5

vegyta2004
Need To Set


Enrolled: Apr 2005
Posts: 34
AP: 1

<? //week 2 assignment
$day=date("w");
swich ($day) {
case 0:
echo"http://www.manga-anime.ro";
break;
case 1:
echo"http://www.itzone.ro";
break;
case 2:
echo"http://www.www.manga-anime.ro/forum.php";
break;
case 3:
echo"http://launch.groups.yahoo.com/fanpaulaseling/join";
break;
case 4:
echo"http://www.yahoomail.com";
break;
case 5:
echo"http://www.dragonballarena.com";
break;
case 6:
echo"http://www.hardware-anime.tk";
break;
?>
It gives me the following error:
Parse error: parse error, unexpected '{' in D:\PROGRAME INSTALATE-FUNCTIONALE\PHP Designer 2005\proiecte d'ale mele\_debug_tmp.php on line 3

 

 (#817 2005-05-20 11:36:37) Post Reply
Page 0 1 2 3 4 5

scriptgeek
Need To Set


Enrolled: May 2005
Posts: 3
AP: 1

<?php
//Set variable for date
$today = (date(w));

//use switch to replace likn everyday
switch($today){

//sunday
case"0":
$sitel = "<a href="http://www.scripts.com">scripts.com</a>";
break;

//monday
case"1":
$sitel = "<a href="http://www.scriptschool.com">scriptschool.com</a>";
break;

//tuesday
case"2":
$sitel = "<a href="http://www.yahoo.com">yahoo.com</a>";
break;

//wednesday
case"3":
$sitel = "<a href="http://www.newgrounds.com">newgrounds.com</a>";
break;

//thursday
case"4":
$sitel = "<a href="http://www.actionscript.org">actionscript.org</a>";
break;

//firday
case"5":
$sitel = "<a href="http://www.planetphotoshop.com">planetphotoshop.com</a>";
break;

//saturday
case"6":
$sitel = "<a href="http://www.flashkit.com">flashkit.com</a>";
break;

default:
$sitel = "no url";
}//<----------------//end switch

print("Today's link is $sitel");

php?>

 

 (#820 2005-05-21 23:13:26) Post Reply
Page 0 1 2 3 4 5

DarePoo
Need To Set


Enrolled: May 2005
Posts: 10
AP: 1


<html>
<head>
<title>SchoolScript.com Assignment #2</title></head>
<body>
<?
//Getting strings sorted out

$today=date("w");
$day=date("l");

switch(
$today)
{
case
"0":
$url="<a href\"http://www.downtownmafia.com\">DownTown Mafia</a>";
$desc="Sunday's Link";
break;
case
"1":
$url="<a href\"http://www.bootleggers.com\">Bootleggers</a>";
$desc="Monday's Link";
break;
case
"2":
$url="<a href\"http://www.projectrockstar.com\">Project Rockster</a>";
$desc="Tuesday's Link";
break;
case
"3":
$url="<a href=\"http://www.themafianetwork.net\">The Mafia Network</a>";
$desc="Wednesday's Link";
break;
case
"4":
$url="<a href=\"http://www.adr-clan.com\">Army of Divine Rights Gaming Clan</a>";
$desc="Thursday's Link";
break;
case
"5":
$url="<a href=\"http://www.msn.com\">MSN Home</a>";
$desc="Friday's Link";
break;
case
"6":
$url="<a href=\http://www.americasarmy.com\">America's Army</a>";
$desc="Saturday's Link";
break;
default:
}
print(
"Today is <b> $day </b>. The link I have for you today is <i> $url </i> - <b>

$desc </b>."
);
?>
</body>
</html>


 

 (#821 2005-05-21 23:16:05) Post Reply
Page 0 1 2 3 4 5

DarePoo
Need To Set


Enrolled: May 2005
Posts: 10
AP: 1

My code with comments.



<html>
<head>
<title>SchoolScript.com Assignment #2</title></head>
<body>
<?
//Getting strings sorted out

$today=date("w");
$day=date("l");

//starting switch
switch($today)
{
case
"0": // Sunday
$url="<a href\"http://www.downtownmafia.com\">DownTown Mafia</a>";
$desc="Sunday's Link";
break;
case
"1": // Monday
$url="<a href\"http://www.bootleggers.com\">Bootleggers</a>";
$desc="Monday's Link";
break;
case
"2": // Tuesday
$url="<a href\"http://www.projectrockstar.com\">Project Rockster</a>";
$desc="Tuesday's Link";
break;
case
"3": // Wednesday
$url="<a href=\"http://www.themafianetwork.net\">The Mafia Network</a>";
$desc="Wednesday's Link";
break;
case
"4": // Thursday
$url="<a href=\"http://www.adr-clan.com\">Army of Divine Rights Gaming Clan</a>";
$desc="Thursday's Link";
break;
case
"5": // Friday
$url="<a href=\"http://www.msn.com\">MSN Home</a>";
$desc="Friday's Link";
break;
case
"6": // Saturday
$url="<a href=\http://www.americasarmy.com\">America's Army</a>";
$desc="Saturday's Link";
break;
default:
}
print(
"Today is <b> $day </b>. The link I have for you today is <i> $url </i> - <b>

$desc </b>."
);
?>
</body>
</html>



sorry for the double post

 

 (#869 2005-09-09 07:06:02) Post Reply
Page 0 1 2 3 4 5

Sudheer
Need To Set


Enrolled: Aug 2005
Posts: 2
AP: 1

<?
$today=date("w");
switch($today){
case 0 :
$site="<a href=http://www.yahoo.com/>Yahoo</a>";
$sitedetails="The Sunday site is ";
break;
case 1:
$site="<a href=http://www.google.com/>Google</a>";
$sitedetails="The Monday site is ";
break;
case 2:
$site="<a href=http://www.scriptschool.com/>Scriptschool</a>";
$sitedetails="The Tuesday site is ";
break;
case 3:
$site="<a href=http://www.php.net/>PHP</a>";
$sitedetails="The Wednesday site is ";
break;
case 4:
$site="<a href=http://www.amazon.com/>Amazon</a>";
$sitedetails="The Thursday site is ";
break;
case 5:
$site="<a href=http://www.hotmail.com/>Hotmail</a>";
$sitedetails="The Friday site is ";
break;
case 6:
$site="<a href=http://www.zend.com/>Zend</a>" ;
$sitedetails="The Saturday site is ";
break;

default:
print ("No such day found");
}
Print($sitedetails.$site);
?>

 

 (#874 2005-10-11 12:22:01) Post Reply
Page 0 1 2 3 4 5

acsinclair
Need To Set


Enrolled: Aug 2005
Posts: 3
AP: 1



<?php
$site1
='<a href="http://www.alistapart.com">A List Apart</a>'; //Sites as variables
$site2='<a href="http://www.mezzoblue.com">Mezzoblue.com</a>';
$site3='<a href="http://www.7nights.com/asterisk/">Asterisk</a>';
$site4='<a href="http://www.stopdesign.com/">Stop Design</a>';
$site5='<a href="http://www.adaptivepath.com/">Adaptive Path</a>';
$site6='<a href="http://www.zeldman.com/">Zeldman</a>';
$site7='<a href="http://www.molly.com/">Molly.com</a>';
$today="date(w)";
switch(
$today)
{
case
0:
$site="Today's Site of the Day is: $site1";
break;

case
1:
$site="Today's Site of the Day is: $site2";
break;

case
2:
$site="Today's Site of the Day is: $site3";
break;

case
3:
$site="Today's Site of the Day is: $site4";
break;

case
4:
$site="Today's Site of the Day is: $site5";
break;

case
5:
$site="Today's Site of the Day is: $site6";
break;

case
6:
$site="Today's Site of the Day is: $site7";
break;
default:
print(
"THERE IS NO SITE OF THE DAY???");
}
print(
"What is the site of the day?<br>$site");
?>



 

 (#875 2005-10-11 12:42:44) Post Reply
Page 0 1 2 3 4 5

acsinclair
Need To Set


Enrolled: Aug 2005
Posts: 3
AP: 1



<?php
$site1
='<a href="http://www.alistapart.com">A List Apart</a>'; //Sites as variables
$site2='<a href="http://www.mezzoblue.com">Mezzoblue.com</a>';
$site3='<a href="http://www.7nights.com/asterisk/">Asterisk</a>';
$site4='<a href="http://www.stopdesign.com/">Stop Design</a>';
$site5='<a href="http://www.adaptivepath.com/">Adaptive Path</a>';
$site6='<a href="http://www.zeldman.com/">Zeldman</a>';
$site7='<a href="http://www.molly.com/">Molly.com</a>';
$today="date(w)";
switch(
$today)
{
case
0:
$site="Today's Site of the Day is: $site1";
break;

case
1:
$site="Today's Site of the Day is: $site2";
break;

case
2:
$site="Today's Site of the Day is: $site3";
break;

case
3:
$site="Today's Site of the Day is: $site4";
break;

case
4:
$site="Today's Site of the Day is: $site5";
break;

case
5:
$site="Today's Site of the Day is: $site6";
break;

case
6:
$site="Today's Site of the Day is: $site7";
break;
default:
print(
"THERE IS NO SITE OF THE DAY???");
}
print(
"What is the site of the day?<br>$site");
?>



 

 (#876 2005-10-21 06:15:15) Post Reply
Page 0 1 2 3 4 5

jewelz
Need To Set


Enrolled: Sep 2005
Posts: 2
AP: 1



<html>

<head>
<title>Script School course 2</title>
</head>

<body>
<center>
<?php
$dayw
=date("l");
$_today=date("w");
$_sun0=("<img src="days/0.jpg">");
$_site0="<a href=http://www.google.com>Google";
$_mon1=("<img src="days/1.jpg">");
$_site1="<a href=http://www.msn.com>MSN";
$_tue2=("<img src="days/2.jpg">");
$_site2="<a href=http://www.yahoo.com>Yahoo";
$_wed3=("<img src="days/3.jpg">");
$_site3="<a href=http://www.jewelzone3.co.uk/datepic.php>This script";
$_thu4=("<img src="days/4.jpg">");
$_site4="<a href=http://www.ebay.com>Ebay";
$_fri5=("<img src="days/5.jpg">");
$_site5="<a href=http://www.scriptschool.com>Script School";
$_sat6=("<img src="days/6.jpg">");
$_site6="<a href=http://www.computerfairs.com.au>Computer fair";
switch(
$_today)
{
case
"0":
print(
$_sun0 .$_site0);// it is true so do this
break; // escape the switch since we had a true result

case "1":
print(
$_mon1 .$_site1);
break;

case
"2":
print(
$_tue2 .$_site2);
break;

case
"3":
print(
$_wed3 .$_site3);
break;

case
"4":
print(
$_thu4 .$_site4);
break;

case
"5":
print(
$_fri5 .$_site5);
break;

case
"6":
print(
$_sat6 .$_site6);
break;

default:
print(
"Today you can sue me as i have this script wrong");// when nothing is true do this
}

?>
</center>
</body>

</html>


 

 (#878 2005-10-22 12:01:08) Post Reply
Page 0 1 2 3 4 5

Goudarzi
Need To Set


Enrolled: Oct 2005
Posts: 9
AP: 1

<?php
$today = date("w");
switch($today)
{
case 1: print('<a href= "http://www.google.com">Google</n>--love google');break;
case 2: print('<a href="http://www.altavista.com">Altavista</a>-- Just wrote that for no reason'); break;
case 3: print('<a href="http://www.bellsouth.net">Bellsouth</a>--My Email'); break;
case 4: print('<a href="http://www.yahoo.com">Yahoo</a>--Yahoo Rocks'); break;
case 5: print('<a href="http://www.monarchknights.com">Monarch </a>-- My School'); break;
case 6: print('<a href="http://www.gmail.com">GMAIL</a>--Google Mail'); break;
default: print('No Links for today'); break;
}
?>

 

 (#880 2005-10-28 18:27:33) Post Reply
Page 0 1 2 3 4 5

DarePoo
Need To Set


Enrolled: May 2005
Posts: 10
AP: 1



<?php

//Naming strings
$day = date("w");
$sunurl = 'www.Sunday.com';
$sundes = Sunday;
$monurl = 'www.Monday.com';
$mondes = Monday;
$tueurl = 'www.Tuesday.com';
$tuedes = Tuesday;
$wedurl = 'www.Wendsday.com';
$weddes = Wendsday;
$thuurl = 'www.Thursday.com';
$thudes = Thursday;
$friurl = 'www.Friday.com';
$frides = Friday;
$saturl = 'www.Saturday.com';
$satdes = Saturday;

//Starting my switch
switch($day){
case
'0':
print(
'Today is ' . $sundes . '. <br> Our link for today is ' . $sunurl . '');
break;
case
'1':
print(
'Today is ' . $mondes . '. <br> Our link for today is ' . $monurl . '');
break;
case
'2':
print(
'Today is ' . $tuedes . '. <br> Our link for today is ' . $tueurl . '');
break;
case
'3':
print(
'Today is ' . $weddes . '. <br> Our link for today is ' . $wedurl . '');
break;
case
'4':
print(
'Today is ' . $thudes . '. <br> Our link for today is ' . $thuurl . '');
break;
case
'5':
print(
'Today is ' . $frides . '. <br> Our link for today is ' . $friurl . '');
break;
case
'6':
print(
'Today is ' . $satdes . '. <br> Our link for today is ' . $saturl . '');
break;
default:
print(
'I guess there now is a new 8th day in the week. Well that or my coding is wrong.');
}
//end of my switch

?>
<html>
<head>
<title>Week #2</title>
</head>
</html>


 

 (#891 2005-11-22 20:36:04) Post Reply
Page 0 1 2 3 4 5

emanoyhl
Need To Set


Enrolled: Nov 2005
Posts: 3
AP: 1

<?

$today = date("w");
$mon = "<a href=\"http://www.insidebear.com\">INSIDE Bear Magazine</a>";
$tue = "<a href=\"http://www.bearnakedart.com\">Bear Naked Art!</a>";
$wed = "<a href=\"http://www.pastrygreek.com\">The Pastry Greek</a>";
$thu = "<a href=\"http://www.postyourtheory.com\">Post Your Theory!</a>";
$fri = "<a href=\"http://www.ikariansea.com\">Ikarian Sea</a>";
$sat = "<a href=\"http://www.bearpcrepair.com\">Bear PC Repair</a>";
$sun = "<a href=\"http://www.yahoo.com\">Yahoo Search</a>";
$error = "Sorry, there are no links for today!";


switch("$today") {

case "0":
print("$mon");
break;

case "1":
print("$tue");
break;

case "2":
print("$wed");
break;

case "3":
print("$thu");
break;

case "4":
print("$fri");
break;

case "5":
print("$sat");
break;

case "6":
print("$sun");
break;

default:
print("$error");

}

?>

 

 (#903 2005-12-08 14:03:32) Post Reply
Page 0 1 2 3 4 5

mgh397
Need To Set


Enrolled: Nov 2005
Posts: 2
AP: 1



<html>
<head>
<title>Sponsor of the Day</title>
</head>
<body>

<?php
print("<center><b>ScriptSchool.Com Assignment 2</b></center><br><br>");

//Variables
$today = date("w");
$imgpath=("images/");

switch(
$today)
{
case
"0";
$img = "drunken18.gif";
$url = "http://refer.ccbill.com/cgi-bin/clicks.cgi?CA=925877-0001&PA=1115296&HTML=http://www.drunken18.com/?id=ec_wm3628";
$url_title = "Drunken18.com";
$url_desc = "Drunken18.com";
break;
case
"1";
$img = "latentgay.gif";
$url = "http://refer.ccbill.com/cgi-bin/clicks.cgi?CA=925877-0002&PA=1115296&HTML=http://www.latentgay.com/?id=ec_wm3628";
$url_title = "LatentGay.com";
$url_desc = "LatentGay.com";
break;
case
"2";
$img = "punishedgay.gif";
$url = "http://refer.ccbill.com/cgi-bin/clicks.cgi?CA=925877-0005&PA=1115296&HTML=http://www.punishedgay.com/?id=ec_wm3628";
$url_title = "PunishedGay.com";
$url_desc = "PunishedGay.com";
break;
case
"3";
$img = "drunkenbi.gif";
$url = "http://refer.ccbill.com/cgi-bin/clicks.cgi?CA=925877-0007&PA=1115296&HTML=http://www.drunkenbi.com/?id=ec_wm3628";
$url_title = "DrunkenBi.com";
$url_desc = "DrunkenBi.com";
break;
case
"4";
$img = "drunkengay.gif";
$url = "http://refer.ccbill.com/cgi-bin/clicks.cgi?CA=925877-0008&PA=1115296&HTML=http://www.drunkengay.com/?id=ec_wm3628";
$url_title = "DrunkenGay.com";
$url_desc = "DrunkenGay.com";
break;
case
"5";
$img = "gaystales.gif";
$url = "http://refer.ccbill.com/cgi-bin/clicks.cgi?CA=925877-0011&PA=1115296&HTML=http://www.gaystales.com/?id=ec_wm3628";
$url_title = "GaysTales.com";
$url_desc = "GaysTales.com";
break;
case
"6";
$img = "gaysgloryholes.gif";
$url = "http://refer.ccbill.com/cgi-bin/clicks.cgi?CA=925877-0012&PA=1115296&HTML=http://www.gaysgloryholes.com/?id=ec_wm3628";
$url_title = "GaysGloryHoles.com";
$url_desc = "GaysGloryHoles.com";
break;
}

// Output results
print("<center><h2>Website of the day</h2><p><a href=\"$url\" target=\"_blank\" onmouseover=\"window.status='$url_title'; return true; \"onmouseout=\"window.status=\''; return true;\"><img src=\"$imgpath/$img\" alt=\"$url_title\"></a><br><a href=\"$url\" target=\"_blank\" onmouseover=\"window.status='$url_title'; return true; \"onmouseout=\"window.status=\''; return true;\">$url_desc</a></p></center>");

?>
</body>
</html>


It can be seen in http://www.mgh397.be/phpschool/002.php

 

 (#911 2005-12-29 19:34:00) Post Reply
Page 0 1 2 3 4 5

Dylan
Need To Set


Enrolled: Dec 2005
Posts: 14
AP: 1



<html>
<body>

<?php

$today
= date("w");

// Use switch to parse the date
switch($today)
{

case
0:
// it is Sunday set $newurl to the Sunday page
$newurl="Sunday";
break;

case
1:
// it is Monday set $newurl to the Monday page
$newurl="Monday";
break;

case
2:
// it is Tuesday set $newurl to the Tuesday page
$newurl="Tuesday";
break;

case
3:
// it is Wednesday set $newurl to the Wednesday page
$newurl="Wednesday";
break;

case
4:
// it is Thursday set $newurl to the Thursday page
$newurl="Thursday";
break;

case
5:
// it is Friday set $newurl to the Friday page
$newurl="Friday";
break;

case
6:
// it is Saturday set $newurl to the Saturday page
$newurl="Saturday";
break;
default:
// else do this
$newurl="NoDate";
}

// Display the link
print("The current date is: " . "<a href=" . $newurl . ".html>" . $newurl . "</a>");

?>
</body>
</html>


 

 (#929 2006-01-22 15:21:36) Post Reply
Page 0 1 2 3 4 5

yanny0808
Need To Set


Enrolled: Jan 2006
Posts: 3
AP: 1



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Assignment 2</title>
</head>

<body>
<?php
//day of week numeric 0-6
$today = date("w");

//compare day of week with the date of today
switch ($today)
{
case
0:
$website = "<a href="http://www.google.com">Google.com</a>";
break;

case
1:
$website = "<a href='http://www.mamma.com'>Mamma.com</a>";
break;

case
2:
$website = "<a href="http://www.yahoo.com">Yahoo.com</a>";
break;

case
3:
$website = "<a href='http://www.hotbot.com'>Hotbot.com</a>";
break;

case
4:
$website = "<a href="http://www.altavista.com">Altavista.com</a>";
break;

case
5:
$website = "<a href='http://www.msn.com'>Msn.com</a>";
break;

case
6:
$website = "<a href="http://www.teoma.com">Teoma.com</a>";
break;

}
//display it
print "Today is $today and I offer you this hyperlink: $website";

?>


</body>
</html>







 

 (#931 2006-01-24 09:55:33) Post Reply
Page 0 1 2 3 4 5

Neville
Need To Set


Enrolled: Jan 2006
Posts: 2
AP: 1



<?php
//description integers
$link="";
$today=date("w");
$sunlink="<b><a href='http://aimczclan.xeeblo.net'>AimClan</a></b><br>";
$monlink="<b><a href='http://www.hotmail.com'>hotmail</a></b><br>";
$tuelink="<b><a href='http://www.xeeblo.net'>xeeblo</a></b><br>";
$wenlink="<b><a href='http://www.ninemsn.com.au'>ninemsn.com</a></b><br>";
$thrulink="<b><a href='http://www.funnyshit.com'>funnyshit.com</a></b><br>"