• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

PHP confused

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

deRusett

Member
Joined
Jul 30, 2002
Location
Midland, Ontario
Code:
<?
$work = date(w);

if ($work == 6){
echo "<h1>Sunday </h1>";

}elseif ($hwork == 0){
echo "<h1>Monday</h1> ";

}elseif ($work == 1){
echo "<h1>Tuesday</h1> ";

}elseif ($work == 2){
echo "<h1>Wednesday</h1>";

}elseif ($work == 3){
echo "<h1>thursday</h1>";

}elseif ($work == 4){
echo "<h1>Friday</h1>";


}else{
echo "<h1>Saturday</h1>";

}
?>

I made this little script,

its to display the next days work schedule /* I will be changing the days of the week to be variables but for testing they are just words */

When I use the funtion as is, the word Monday is displayed, when Friday should be, since it is thursday night.


if I replace the $work == 0 wirh $work == 5 Friday displays, I don't understand,
this shouldn't happen

anyone have any ideas?

didn't know were else to post this, normally I don't look for help, but this just baffles me and makes no sence.
 
um....you've acidently put hwork

}elseif ($hwork == 0){
echo "<h1>Monday</h1> ";

remove it and it should work
 
thats alrightwe all do it. You get blind to a problem that you can't see. Then somebody else comes along and points out the very obvious problem.
 
Back