School Map:
Home / Enroll
$ Student Records; Class
$ News @ LIVE
Tech Radio * Support/FAQ
| Store | FORUMS
|
FamYon
|
Yes I noticed that I changed it from case0 to case 0. Thanks for pickup :-)
FamYon |
|
jcast
|
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. :) |
|
Aktar
|
<? $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) ?> |
|
Aktar
|
am i doing something wrong? how my text comes up big and ugly here? |
|
LowenWolfe
|
Here is my script ... better documentation than week 1's ;)
LowenWolfe |
|
zman
|
My Assignment #2:
|
|
irunat2am
|
|
|
irunat2am
|
|
|
irunat2am
|
Please erase the previous 2 posts of mine..browser freaked out.
<br><br>Live Demo: <a href="http://www.mghstudios.com/phptesting/test2.php">Week 2</a> |
|
N8miah
|
<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> |
|
michaelp
|
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 () |
|
michaelp
|
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 () |
|
vegyta2004
|
I have a problem.
I don't understand the swich,case syntax |
|
vegyta2004
|
<? //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 |
|
scriptgeek
|
<?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?> |
|
DarePoo
|
|
|
DarePoo
|
My code with comments.
sorry for the double post |
|
Sudheer
|
<?
$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); ?> |
|
acsinclair
|
|
|
acsinclair
|
|
|
jewelz
|
|
|
Goudarzi
|
<?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; } ?> |
|
DarePoo
|
|
|
emanoyhl
|
<?
$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"); } ?> |
|
mgh397
|
It can be seen in http://www.mgh397.be/phpschool/002.php |
|
Dylan
|
|
|
yanny0808
|
|
|
Neville
|
|