Jump to content

waterssaz

Members
  • Posts

    111
  • Joined

  • Last visited

    Never

Everything posted by waterssaz

  1. I have fixed sytax errors and wrong variable referencing as below: <?php $preseason = strtotime('2009-08-11'); $week1 = strtotime('2009-08-18'); $week2 = strtotime('2009-08-25'); $week3 = strtotime('2009-09-01'); $week4 = strtotime('2009-09-08'); $week5 = strtotime('2009-09-15'); $week6 = strtotime('2009-09-22'); $week7 = strtotime('2009-09-29'); $week8 = strtotime('2009-10-06'); $week9 = strtotime('2009-10-13'); $week10 = strtotime('2009-10-20'); $weeks_array = array($preseason, $week1, $week2, $week3, $week4, $week5, $week6, $week7, $week8, $week9, $week10); print_r($weeks_array); $today = strtotime(date('Y-m-d', time())); echo $today; $poll_week = ''; if ($today < $weeks_array[0]) { $poll_week = 'Pre-Season'; } if ($today > $weeks_array[10]) { $poll_week = 'Closed'; } if ($poll_week == '') { for ($i=0; $i<count($weeks_array); $i++) { if ($today >= $weeks_array[$i] && $today < $weeks_array[$i+1]) { $poll_week = 'Week ' . $i; } } } echo $poll_week; ?>
  2. The array is constructed absolutely fine its the rest of your code that is failing
  3. Also in your class class MyCube { // var $value; var $result; function calculate() { $result = $value * $value * $value; return $result; } } should be class MyCube { // var $value; var $result; function calculate() { $result = $this->value * $this->value * $this->value; return $result; } }
  4. well you should get an error ;-) you are not calling the class function properly at all. should be: $MyCalc = &New MyCube; $MyCalc ->value = 4; $Return = $MyCalc->calculate(); echo "Value = " . $Return;
  5. And the job nos are displaying correctly from this line yes? echo "<p><b>Job ID:</b> ". $output['JobNo'];
  6. sorry didn't read properly waht you are trying to do. have changed above code slightly to this: $sql = "SHOW TABLES FROM $db_name"; $result = mysql_query($sql); if (!$result) { echo "DB Error, could not list tables\n"; echo 'MySQL Error: ' . mysql_error(); exit; } echo "<table>"; while ($row= mysql_fetch_row($result)) { echo "<tr>"; echo "<td>{$row[0]}</td>"; echo "</tr>"; } echo "</table>"; mysql_free_result($result); ?>
  7. remove the brackets around the input fileds
  8. Try this, obviously i haven't tested it :-) $sql = "SHOW TABLES FROM $db_name"; $result = mysql_query($sql); if (!$result) { echo "DB Error, could not list tables\n"; echo 'MySQL Error: ' . mysql_error(); exit; } echo "<table>"; while ($row= mysql_fetch_array($result)) { echo "<tr>"; echo "<td>{$row['COLUMN_NAME FROM DATABASE']}</td>"; echo "</tr>"; } echo "</table>"; mysql_free_result($result); ?>
  9. the id is not escaped out on the hidden field and I didn't notice it. change echo("<INPUT TYPE=\"hidden\" NAME=\"JobNumber\" VALUE= \"$output['JobNo']\" id='JobNumber'>"); to echo("<INPUT TYPE=\"hidden\" NAME=\"JobNumber\" VALUE= \"$output['JobNo']\" id=\"JobNumber\">");
  10. I would output the following part like this: while ($output=mysql_fetch_array($results)) { echo "<p><b>Job ID:</b> ". $output['JobNo']; echo "<br /><b>Desc:</b> ". $output['Job_Desc']; echo "<br /><b>Print Date:</b> ". $output['Print_Date']; echo "<br /><b>Delivery Date:</b> ". $output['Delivery_Date']; echo "<br />"; echo("<INPUT TYPE=\"hidden\" NAME=\"JobNumber\" VALUE= \"$output['JobNo']\" id='JobNumber'>"); echo("<INPUT TYPE=\"submit\" NAME=\"ViewJob\" VALUE=\"View Job\">"); echo "<hr /></p>";}
  11. Ok, I'm surprsied that you can see any list of jobs. I have never seen array keys accessed without the quotes around them like this???
  12. post your code for the hidden field that you pass :-)
  13. I can not see the need for the last ); underneath the //End ultimate points
  14. As above, you never closed the array. thats where the error was;
  15. can you post a few lines of code before the query please?
  16. can't see anything obvious after a quick sacn over the code. Do you have any errors outputting on the screen? :-)
  17. This will work. points to note: 1) You do not set $scale or $degree in your script( I have changed this); 2) You do not give your option values names so that they cab be referenced. <html> <head> <link href="../style/main.css" rel="stylesheet" type="text/css" /> </head> <body> <table class="pad" width="80%" height="*" border="0" bgcolor ="#FFFFFF" align="center"> <tr> <td> <?php include('../includes/secondheader.php') ?> <h2>Temperature Conversion</h2> <form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="get"> Degrees: <input type = "text" name = "degree" size=4> <select name="scale"> <option value="celcius" name="celcius">Celsius</option> <option value="fahrenheit" name="fahrenheit">Fahrenheit</option> <option value="kelvin" name="kelvin">Kelvin</option> <option value="rankine" name = "rankine">Rankine</option> </select> <br/> <input type = "submit" name = "submit"/> </form> <?php if((isset($_GET['submit']))) { $scale= $_GET['scale']; $degree = $_GET['degree']; if ($scale == "celcius") {print "<table border><tr><th colspan=2> Conversion Results</th></tr><tr><td>$degree</td><td>celsius</td></tr>"; $c_2_f = $degree*9/5+32; print "<tr><td>$c_2_f</td><td>fahrenheit</td></tr>"; $c_2_k = $degree+273.15; print "<tr><td>$c_2_k </td><td>kelvin</td></tr>"; $c_2_r = $c_2_f+459.6; print "<tr><td>$c_2_r</td><td>rankine</td></tr></table>";} if ($scale == "fahrenheit") {print "<table border><tr><th colspan=2> Conversion Results</th></tr><tr><td>$degree</td><td>farhenheit</td></tr>"; $f_2_c = ($degree -32)*5/9; print "<tr><td>$f_2_c</td><td>celsius</td></tr>"; $f_2_k = $f_2_c+273.15; print "<tr><td>$f_2_k </td><td>kelvin</td></tr>"; $f_2_r = $degree+459.6; print "<tr><td>$f_2_r</td><td>rankine</td></tr></table>";} if ($scale == "kelvin") {print "<table border><tr><th colspan=2> Conversion Results</th></tr><tr><td> $degree</td><td>kelvin</td></tr>"; $k_2_f = ($degree - 273.15) * 9 / 5 + 32; print "<tr><td>$k_2_f</td><td>fahrenheit</td></tr>"; $k_2_c = $degree-273.15; print "<tr><td>$k_2_c </td><td>celsius</td></tr>"; $k_2_r = $k_2_f+459.6; print "<tr><td>$k_2_r</td><td>rankine</td></tr></table>";} if ($scale == "rankine") {print "<table border><tr><th colspan=2> Conversion Results</th></tr><tr><td>$degree</td><td>rankine</td></tr>"; $r_2_f = $degree-459.6; print "<tr><td>$r_2_f</td><td>fahrenheit</td></tr>"; $r_2_c = ($r_2_f - 32)*5/9; print "<tr><td>$r_2_c </td><td>celsius</td></tr>"; $r_2_k = $r_2_c + 273.15; print "<tr><td>$r_2_k</td><td>kelvin</td></tr></table>";} } ?> <?php include('../includes/footer.php') ?> </td> </tr> </table> </body> </html>
  18. Try this :-) <?php $string = "\$ip[] = '"."".$user."'"; fwrite($banned, $string); ?>
  19. <form method="GET" action="<?php echo $_SERVER['PHP_SELF']; ?>"> replace yours with above, think characters are wrong around the variable
  20. Try this :-) <html> <head> <title></title> <link href="../style/main.css" rel="stylesheet" type="text/css" /> </head> <body> <table class="pad" width="80%" height="*" border="0" bgcolor ="#FFFFFF" align="center"> <tr> <td> <?php include('../includes/secondheader.php') ?> <h2>Temperature Conversion</h2> <form action = "<?php echo $_SERVER[’PHP_SELF’]; ?>" method = "GET"> Degrees: <input type = "text" name = "degree" size=4> <select name="scale"> <option value="celcius">Celsius</option> <option value="fahrenheit">Fahrenheit</option> <option value="kelvin">Kelvin</option> <option value="rankine">Rankine</option> </select> <br/> <input type = "submit" name = "submit"/> </form> <?php if((isset($_GET['submit']))) { if ($scale == "celcius") {print "<table border><tr><th colspan=2> Conversion Results</th></tr><tr><td>$degree</td><td>celsius</td></tr>"; $c_2_f = $degree*9/5+32; print "<tr><td>$c_2_f</td><td>fahrenheit</td></tr>"; $c_2_k = $degree+273.15; print "<tr><td>$c_2_k </td><td>kelvin</td></tr>"; $c_2_r = $c_2_f+459.6; print "<tr><td>$c_2_r</td><td>rankine</td></tr></table>";} if ($scale == "fahrenheit") {print "<table border><tr><th colspan=2> Conversion Results</th></tr><tr><td>$degree</td><td>farhenheit</td></tr>"; $f_2_c = ($degree -32)*5/9; print "<tr><td>$f_2_c</td><td>celsius</td></tr>"; $f_2_k = $f_2_c+273.15; print "<tr><td>$f_2_k </td><td>kelvin</td></tr>"; $f_2_r = $degree+459.6; print "<tr><td>$f_2_r</td><td>rankine</td></tr></table>";} if ($scale == "kelvin") {print "<table border><tr><th colspan=2> Conversion Results</th></tr><tr><td> $degree</td><td>kelvin</td></tr>"; $k_2_f = ($degree - 273.15) * 9 / 5 + 32; print "<tr><td>$k_2_f</td><td>fahrenheit</td></tr>"; $k_2_c = $degree-273.15; print "<tr><td>$k_2_c </td><td>celsius</td></tr>"; $k_2_r = $k_2_f+459.6; print "<tr><td>$k_2_r</td><td>rankine</td></tr></table>";} if ($scale == "rankine") {print "<table border><tr><th colspan=2> Conversion Results</th></tr><tr><td>$degree</td><td>rankine</td></tr>"; $r_2_f = $degree-459.6; print "<tr><td>$r_2_f</td><td>fahrenheit</td></tr>"; $r_2_c = ($r_2_f - 32)*5/9; print "<tr><td>$r_2_c </td><td>celsius</td></tr>"; $r_2_k = $r_2_c + 273.15; print "<tr><td>$r_2_k</td><td>kelvin</td></tr></table>";} } ?> <?php include('../includes/footer.php') ?> </td> </tr> </table> </body> </html>
  21. $_SERVER['HTTP_REFERER'] cannot always be trusted but if you pop that code at the top of the page (adding the curly braces for the is statment and then enclose the actual page code in an else statemnt I.e <?php if($_SERVER['HTTP_REFERER'] != '') { header("location: somewhere.php"); exit; } else{ // page code to display if referrer does exist } ?>
  22. when you first view the page $scale is not set yet because the form has not been submitted, Add a check submit to solve the problem :-)
  23. The web examples below simpy use 'clean URLs' using mod rewrite on apache (possible with IIS as well). look up these terms and it will all come clear :-)
  24. Ok, thought so, because you are never actually posting this value from the from. Only the category id and subcategory ever get posted, hence the values that you are outputting. In that case try sending the category as a value in a hiden form field as it is only really needed for display purposes that i can see :-)
  25. I take it the field category is the 'state' name?
×
×
  • 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.