School Map:
Home / Enroll
$ Student Records; Class
$ News @ LIVE
Tech Radio * Support/FAQ
| Store | FORUMS
|
ice52us
|
This is my first time programming, and taking what I learned from lesson 1 and 2, this is what i was able to accomplish. I have read some of the other examples, which dont use as many print() but I am pretty sure the lessons dont cover that. |
|
gr
|
|
|
Salluas
|
This one took a little while to get right..man those backslashers before the double quotes are KILLERS!
Enjoy! |
|
fishhead
|
|
|
Samspong
|
|
|
Samspong
|
hmmm there was something wrong with that, was it the spaces between the backslashes, let me see.
|
|
Samspong
|
what the dickens is going on? whats wrong with my code, or more to the point- whats right with it? |
|
lestat
|
Maybe replace the ";"'s in case...
case "0"; to case "0": |
|
lestat
|
OK - If I can do this, anybody can! This is <strong>exciting</strong>, because I made it go. I had a little difficulty missing quotes or semi colons here and there, but it only took me about 45min. With this tutorial I am starting to see the possibilities that can be done with this!
|
|
def
|
|
|
DS
|
Here is my second assignment
still debugging |
|
DS
|
I don't get my errors here
I think it is the quotes in my tag error. I don't know why my string print has a problem though. |
|
DS
|
okay I got it
|
|
DS
|
maybe not third time's the charm
|
|
DS
|
one more time
<HTML> <HEAD> <TITLE>ScriptSchool Second Assignment</TITLE> <BODY> //Switch and case function used to display something different each day of the week <? $today=date(“w”); $sunlink="<A HREF=\"http://www.foxwar.com\">Foxwar</A>"; $monlink="<A=HREF=\"http://www.ebay.com\">Ebay</A>\"; $tueslink="<A HREF=\"http://www.wizards.com/magic\">MagicTheGathering.com</A>"; $wedlink="<A HREF=\"http://www.aatrade.springfield.net">Alien Assault Traders</A>"; $thurlink="<A HREF=\"http://www.blacknovaplus.net\">Blacknova Traders</A>"; $frilink="<A HREF=\"http://www.google.com\">Google</A>"; $satlink="<A HREF=\"http://www.thugbuilder.net\">Thugbuilder</A>"; //begin of switch and case switch ($today) { case 0: print("Todays URL for the day is..." . $sunlink) break; case 1: print("Todays URL for the day is..." . $monlink) break; case 2: print("Todays URL for the day is..." . $tueslink) break; case 3: print("Todays URL for the day is..." . $wedlink) break; case 4("Todays URL for the day is..." . $thurlink) break; case 5 print("Todays URL for the day is..." . $frilink) break; case 6 print("Todays URL for the day is..." . $satlink) //end of switch and case ?> </BODY> </HTML> |
|
MI4C
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>URL a day</title> </head> <body> <? /* This is my second script ever and it was week 2 assigment*/ // day variable $today = date("w"); switch($today) { case 0: // it is true so do this $url = "http://www.google.com"; $title = "google"; break; // escape the switch since we had a true result case 1: $url = "<http://www.altavista.com"; $title = "altavista"; break; case 2: $url = "http://www.microsoft.com"; $title = "microsoft"; break; case 3: $url = "http://www.msn.fi"; $title = "msn"; break; case 4: $url = "http://www.novalogic.com"; $title = "novalogic"; break; case 5: $url = "http://www.novaworld.com"; $title = "novaworld"; break; case 6: $url = "http://www.mirc.com"; $title = "mirc"; break; default: $url = "blank"; // when nothing is true do this } print ( "<a href = \"$url \" <br> $title </a><br>". "$title"); ?> </body> </html> |
|
abectech
|
<?
/* This script selects the day of the week and dynamically creates the URL for that specific day by creating a URL with that given day as a variable in the URL. Once you view the site click the link it will forward you to the URL for that day. If you switch the number at the end betweenn 1-7 you will see you switch days of the week. Try it out! On to lesson 3 for me*/ // This variable is here to input the root URL of the site where the script is posted! $root = "http://127.0.0.1/week2"; // This piece selects the numerical date 1-7 for the current day of the week. $day = date("w"); // This section is for testing. It allows you to set the date to assure that each case is working use integers 1-7 for Monday - Sunday. //$day = 6; //The day_full variable selects the full name of the day to print in the description fot that given day. $day_full = date("l"); //These two statements below are used to test if the day and day_full are correctly setting the date //echo("$day"); //echo("$day_full"); //The switch statment below uses the numerical date for today switch($day) { case"1": $url = "<a href=\"$root/index.php?day=1\">$day_full's Link</a>"; $description = "This is a unique description for $day_full"; break; case"2": $url = "<a href=\"$root/index.php?day=2\">Tuesday's Link</a>"; $description = "This is a unique description for $day_full"; break; case"3": $url = "<a href=\"$root/index.php?day=3\">Wednesday's Link</a>"; $description = "This is a unique description for $day_full"; break; case"4": $url = "<a href=\"$root/index.php?day=4\">Thursday's Link</a>"; $description = "This is a unique description for $day_full"; break; case"5": $url = "<a href=\"$root/index.php?day=5\">Friday Link</a>"; $description = "This is a unique description for $day_full"; break; case"6": $url = "<a href=\"$root/index.php?day=6\">Saturday Link</a>"; $description = "This is a unique description for $day_full"; break; case"7": $url = "<a href=\"$root/index.php?day=7\">Sunday Link</a>"; $description = "This is a unique description for $day_full"; break; // echo statment combines the URL and Description from the valid day and prints it in the browser. } echo("$url - " . "$description"); ?> |
|
Umbra
|
Question: If I were to put this script on my web site to check it, they say path to script should be /home/users/web/####/umbra! Where do I put that?
<HTML> <HEAD><TITLE> Script Lesson #1</TITLE> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <META NAME="Generator" CONTENT="Microsoft Word 73.1"> </HEAD> <BODY> <FONT FACE="Times"> <?php //Object is to write script to store and print name and URL of my webste //Assign variables $firstname="Ted"; $lastname="Erikson"; $website="http://www.sdogv.com"; $MPPOAsite=http://www.madisonparkhydepark.com; //Print the output print("Hello there, my first name is $firstname and my last name is $lastname<BR> My personal web site is at $website and <BR> I am a volunteer (new) webmaster at $MPPOAsite") ?> </FONT></BODY> </HTML> |
|
Umbra
|
Question: If I were to put this script on my web site to check it, they say path to script should be /home/users/web/####/umbra! Where do I put that?
<HTML> <HEAD><TITLE> Script Lesson #1</TITLE> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <META NAME="Generator" CONTENT="Microsoft Word 73.1"> </HEAD> <BODY> <FONT FACE="Times"> <?php //Object is to write script to store and print name and URL of my webste //Assign variables $firstname="Ted"; $lastname="Erikson"; $website="http://www.sdogv.com"; $MPPOAsite=http://www.madisonparkhydepark.com; //Print the output print("Hello there, my first name is $firstname and my last name is $lastname<BR> My personal web site is at $website and <BR> I am a volunteer (new) webmaster at $MPPOAsite") ?> </FONT></BODY> </HTML> |
|
Umbra
|
In reviewing post, I found some errors; hopefully corrcted here.
Question: If I were to put this script on my web site to check it, they (my server) say path to script should be /home/users/web/####/umbra! Where do I put that? <HTML> <HEAD><TITLE> Script Lesson #1</TITLE> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <META NAME="Generator" CONTENT="Microsoft Word 73.1"> </HEAD> <BODY> <FONT FACE="Times"> <?php //Object is to write script to store and print name and URL of my webste //Assign variables $firstname="Ted"; $lastname="Erikson"; $website="http://www.sdogv.com"; $MPPOAsite=http://www.madisonparkhydepark.com; //Print the output print("Hello there, my first name is $firstname and my last name is $lastname<BR> My personal web site is at $website and <BR> I am a volunteer (new) webmaster at $MPPOAsite"); ?> </FONT></BODY> </HTML> |
|
lestat
|
Umbra:
When posting your code use the " |
|
lestat
|
the CODE tags |
|
Marcel
|
Ok, hope this is the way you meant it :P
Any comments are welcome ! |
|
schoon
|
i get this error: Parse error: parse error, unexpected '>' in /home/sites/reaction-gaming.co.uk/public_html/assignment2.php on line 36 Help plz!! thx. |
|
SexToyLady
|
<?
$today =date("w"); $text = "Todays Link is : "; //switch address switch($today) { case "0"; $address = "<a href=\"http://www.charliedaniels.com\">Charlie Daniels</a><br>"; break; case "1"; $address = "<a href=\"http://www.lujack.com\">Lujack Northpark Auto Plaza</a><br>"; break; case "2"; $address = "<a href=\"http://www.millercontainer.com\">Miller Container</a><br>"; break; case "3"; $address = "<a href=\"http://www.kwqc.com\">KWQC TV 6</a><br>"; break; case "4"; $address = "<a href=\"http://www.qcbankruptcy\">James C. Wherry</a><br>"; break; case "5"; $address = "<a href=\"http://www.qconline.com\">QC Online</a><br>"; break; case "6"; $address = "<a href=\"http://www.qctimes.com\">Quad City Times</a><br>"; break; } Print "$text $address"; ?> |
|
JXWolF
|
|
|
spanweb
|
<html>
<head> <title>Script School Week 2</title> </head> <body> <?php $today = date("w"); //w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday) $url_0 = "http://www.php.net/"; // it is Sunday $url_1 = "http://www.w3schools.com/"; // it is Monday $url_2 = "http://www.zend.com/"; // it is Tuesday $url_3 = "http://www.devshed.com/"; // it is Wednesday $url_4 = "http://www.thesitewizard.com/"; // it is Thursday $url_5 = "http://www.htmlgoodies.com/"; // it is Friday $url_6 = "http://www.hotscripts.com/"; // it is Saturday ?> <b>Today is <u><?php print(date( "l" . ", " . "d" . " " . "F". " " . "Y")); ?></u><br/>Your website will be <?php switch($today) { case 0: // it is Sunday print "<a href= " . $url_0 . " target=_blank " . ">". $url_0 . "</a>"; break; // escape the switch since we had a true result case 1: // it is Monday print "<a href= " . $url_1 . " target=_blank " . ">". $url_1 . "</a>"; break; // escape the switch since we had a true result case 2: // it is Tuesday print "<a href= " . $url_2 . " target=_blank " . ">". $url_2 . "</a>"; break; // escape the switch since we had a true result case 3: // it is Wednesday print "<a href= " . $url_3 . " target=_blank " . ">". $url_3 . "</a>"; break; // escape the switch since we had a true result case 4: // it is Thursday print "<a href= " . $url_4 . " target=_blank " . ">". $url_4 . "</a>"; break; // escape the switch since we had a true result case 5: // it is Friday print "<a href= " . $url_5 . " target=_blank " . ">". $url_5 . "</a>"; break; // escape the switch since we had a true result default: // it is Saturday print "<a href= " . $url_6 . " target=_blank " . ">". $url_6 . "</a>"; } ?> </b> </body> </html> |
|
spanweb
|
<html>
<head> <title>Script School Week 2</title> </head> <body> <?php $today = date("w"); //w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday) $url_0 = "http://www.php.net/"; // it is Sunday $url_1 = "http://www.w3schools.com/"; // it is Monday $url_2 = "http://www.zend.com/"; // it is Tuesday $url_3 = "http://www.devshed.com/"; // it is Wednesday $url_4 = "http://www.thesitewizard.com/"; // it is Thursday $url_5 = "http://www.htmlgoodies.com/"; // it is Friday $url_6 = "http://www.hotscripts.com/"; // it is Saturday ?> <b>Today is <u><?php print(date( "l" . ", " . "d" . " " . "F". " " . "Y")); ?></u><br/>Your website will be <?php switch($today) { case 0: // it is Sunday print "<a href= " . $url_0 . " target=_blank " . ">". $url_0 . "</a>"; break; // escape the switch since we had a true result case 1: // it is Monday print "<a href= " . $url_1 . " target=_blank " . ">". $url_1 . "</a>"; break; // escape the switch since we had a true result case 2: // it is Tuesday print "<a href= " . $url_2 . " target=_blank " . ">". $url_2 . "</a>"; break; // escape the switch since we had a true result case 3: // it is Wednesday print "<a href= " . $url_3 . " target=_blank " . ">". $url_3 . "</a>"; break; // escape the switch since we had a true result case 4: // it is Thursday print "<a href= " . $url_4 . " target=_blank " . ">". $url_4 . "</a>"; break; // escape the switch since we had a true result case 5: // it is Friday print "<a href= " . $url_5 . " target=_blank " . ">". $url_5 . "</a>"; break; // escape the switch since we had a true result default: // it is Saturday print "<a href= " . $url_6 . " target=_blank " . ">". $url_6 . "</a>"; } ?> </b> </body> </html> |
|
wakjoko
|
<html>
<head><title>Learn PHP with scriptschool.com ::: 2nd week assignment</title> <body> <?php //start php code //declare an array to store 6 string $url_arr=array("yahoo.com", "google.com", "aol.com", "lycos.com", "msn.com", "hotbot.com"); //start comparing and print switch(date(w)){ case 0: print("Today's(".date(l).") url is <a href="http://".$url_arr[date(w)]."">".$url_arr[date(w)]."</a>"); break; case 1: print("Today's(".date(l).") url is <a href="http://".$url_arr[date(w)]."">".$url_arr[date(w)]."</a>"); break; case 2: print("Today's(".date(l).") url is <a href="http://".$url_arr[date(w)]."">".$url_arr[date(w)]."</a>"); break; case 3: print("Today's(".date(l).") url is <a href="http://".$url_arr[date(w)]."">".$url_arr[date(w)]."</a>"); break; case 4: print("Today's(".date(l).") url is <a href="http://".$url_arr[date(w)]."">".$url_arr[date(w)]."</a>"); break; case 5: print("Today's(".date(l).") url is <a href="http://".$url_arr[date(w)]."">".$url_arr[date(w)]."</a>"); break; default: print("Today's(".date(l).") url is <a href="http://".$url_arr[date(w)]."">".$url_arr[date(w)]."</a>"); } ?> </body> </html> |
|
FamYon
|
<HTML>
<HEAD> <TITLE>Assignment 2</TITLE> </HEAD> <BODY> <? //Use conditional to get a url every day of the week $today = date("W"); $link1 = "<A HREF = http://www.site1.com;</A>"; $link1desc = "Click here to visit site 1"; $link2 = "<A HREF = http://www.site2.com;</A>"; $link2desc = "Click here to visit site 2"; $link3 = "<A HREF = http://www.site3.com;</A>"; $link3desc = "Click here to visit site 3"; $link4 = "<A HREF = http://www.site4.com;</A>"; $link4desc = "Click here to visit site 4"; $link5 = "<A HREF = http://www.site5.com;</A>"; $link5desc = "Click here to visit site 5"; $link6 = "<A HREF = http://www.site6.com;</A>"; $link6desc = "Click here to visit site 6"; $link7 = "<A HREF = http://www.site7.com;</A>"; $link7desc = "Click here to visit site 7"; //Use switch case statement switch ($today) { case1: print($link1); print($link1desc); break; case2: print($link2); print($link2desc); break; case3: print($link3); print($link3desc); break; case4: print($link4); print($link4desc); break; case5: print($link5); print($link5desc); break; case6: print($link6); print($link6desc); break; case7: print($link7); print($link7desc); break; //default item default: case1: print($link1); print($link1desc); } ?> </BODY> </HTML> |
View Previous Thread Print This Page |
School Map:
Home / Enroll
$ Student Records; Class
$ News @ LIVE
Tech Radio * Support/FAQ
| Store
Advertising
| Link To Us | Privacy
Copyright 2000-2002 Script School Productions / KMR
Enterprises
No part of this website may be reproduced, copied and/or distributed
in any medium
without express written permission