Jump to content

rslnerd

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Everything posted by rslnerd

  1. Thanks! I've never used switch before, so I wouldn't have thought of that... Thanks a ton!
  2. Sorry if I sound like a total idiot, but I don't know how to do this I have a bunch of array variables that I need to access based on an inputted value. It's a dropdown menu, so the values are predetermined. For example: <?php $var1 = array("blah1","blah2","blah3","blah4"); $var2 = array("foo1","foo2","foo3","foo4"); $var3 = array("nothing1","nothing2","nothing3","nothing4"); ?> <form method="get" action="this.php" name="this"> <select> <option value="var1">1</option> <option value="var2">2</option> <option value="var3">3</option> </select> </form> So I want it so that if the user selects option 1, var1 can be accessed and i can use the array to do the calculation needed... How can I use the value to access the variable?
  3. Never mind... as I wrote this post, someone posted one more minor error I made, and that fixed it... Thanks!!
  4. I put up a post about 20 mins ago needing help b/c my script was not loading on the page... I had a minor typo that was pointed out to me, and I fixed that... It's still not working... I'm so new to this, and I've gone over my script ten times... The page link is http://tech-shep.com/users/rslnerd/jsprogs/dow.php The script is designed to find the day of week of any day... here's the code... <html> <head> <title>Day of Week Finder</title> <?php $day = date("d"); $month = date("m"); $year = date("Y"); $today = $day; $thismonth = $month; $thisyear = $year; $done = 0; $daysofweek = array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"); $months = array("month number zero","January","February","March","April","May","June","July","August","September","October","November","December"); if ((isset($_GET[month]) && isset($_GET[day]) && isset($_GET[year])) && (checkdate($_GET[month],$_GET[day],$_GET[year])) { $month = $_GET[month]; $day = $_GET[day]; $year = $_GET[year]; $done = 1; } if ($done = 0) { $month = $realmonth; $day = $realday; $year = $realyear; $month += 10; $month %= 12; if ($month == 0) $month = 12; if (($month == 12) || ($month == 11)) $year -= 1; $year = $chyeary; $year = $chyearc; $chyeary %= 100; $chyearc = ($chyearc - $chyeary)/100; $total = $day + floor((13 * $month - 1) / 5) + $chyeary + floor($chyeary / 4) + floor($chyearc / 4) - (2 * $chyearc); $total %= 7; $dow = $daysofweek[$total]; $tense = "was"; if (($day == $today) && ($month == $thismonth) && ($year == $thisyear)) $tense = "is"; elseif (($year > $thisyear) || (($year == $thisyear) && ($month > $thismonth)) || (($year == $thisyear) && ($month == $thismonth) && ($day > $today))) $tense = "will be"; } if ($realyear < 1760) $done = 2; ?> </head> <body> <form action="dow.php" method="get"> <table border> <tr bgcolor=black> <th> <input type="text" size=1 maxlength=2 name="month" value=<?php echo $month;?>></th><th> <input type="text" size=1 maxlength=2 name="day" value=<?php echo $day;?>></th><th> <input type="text" size=3 maxlength=4 name="year" value=<?php echo $year;?>></th></tr> <tr bgcolor=blue><td> <small>Month</small></td><td> <small>Day</small></td><td> <small>Year</small></td></tr><tr bgcolor=red><th colspan=3> <input type="submit" value="Calculate"></th></tr></table> </form><br/> <?php if ($done = 1) echo "<h2>" . $day . " " . $months[$month] . " " . $year . " " . $tense . " a " . $dow . ".</h2>"; elseif ($done = 2) echo "<h3>Date must be after 1760.</h3>"; else echo "<h3>Enter any date after 1760.</h3>"; ?> </body> </html> Thanx for your time... -rslnerd
  5. Sorry about that, but thanx for the help...
  6. I've been writing a little script to find the day of the week for any day... I finished it, uploaded it to my friend's server, and it loads totally blank... Here's the link: http://tech-shep.com/users/rslnerd/jsprogs/dow.php Here's the code: <html> <head> <title>Day of Week Finder</title> <?php $day = date("d"); $month = date("m"); $year = date("Y"); $today = $day; $thismonth = $month; $thisyear = $year; $done = 0; $daysofweek = array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday); $months = array("month number zero","January","February","March","April","May","June","July","August","September","October","November","December"); if ((isset($_GET[month]) && isset($_GET[day]) && isset($_GET[year])) && (checkdate($_GET[month],$_GET[day],$_GET[year])) { $month = $_GET[month]; $day = $_GET[day]; $year = $_GET[year]; $done = 1; } if ($done = 0) { $month = $realmonth; $day = $realday; $year = $realyear; $month += 10; $month %= 12; if ($month == 0) $month = 12; if (($month == 12) || ($month == 11)) $year -= 1; $year = $chyeary; $year = $chyearc; $chyeary %= 100; $chyearc = ($chyearc - $chyeary)/100; $total = $day + floor((13 * $month - 1) / 5) + $chyeary + floor($chyeary / 4) + floor($chyearc / 4) - (2 * $chyearc); $total %= 7; $dow = $daysofweek[$total]; $tense = "was"; if (($day == $today) && ($month == $thismonth) && ($year == $thisyear)) $tense = "is"; elseif (($year > $thisyear) || (($year == $thisyear) && ($month > $thismonth)) || (($year == $thisyear) && ($month == $thismonth) && ($day > $today))) $tense = "will be"; } if ($realyear < 1760) $done = 2; ?> </head> <body> <form action="dow.php" method="get"> <table border> <tr bgcolor=black> <th> <input type="text" size=1 maxlength=2 name="month" value=<?php echo $month;?>></th><th> <input type="text" size=1 maxlength=2 name="day" value=<?php echo $day;?>></th><th> <input type="text" size=3 maxlength=4 name="year" value=<?php echo $year;?>></th></tr> <tr bgcolor=blue><td> <small>Month</small></td><td> <small>Day</small></td><td> <small>Year</small></td></tr><tr bgcolor=red><th colspan=3> <input type="submit" value="Calculate"></th></tr></table> </form><br/> <?php if ($done = 1) echo "<h2>" . $day . " " . $months[$month] . " " . $year . " " . $tense . " a " . $dow . ".</h2>"; elseif ($done = 2) echo "<h3>Date must be after 1760.</h3>"; else echo "<h3>Enter any date after 1760.</h3>"; ?> </body> </html> I realise that my mistake is probably a stupid typo or something, but I'm new to PHP, so I really need help... Thanks in advance to whomever helps me... -rslnerd
  7. sorry, i'm new... plz explain...
  8. How can I do something like http://www.politicalcompass.org/printablegraph?ec=0.00&soc=0.00 or http://www.politicalcompass.org/printablegraph?ec=5.00&soc=-5.00 in which I can get an image to move on top of another image in a specific location based on a $_GET variable???
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.