Jump to content

Daney11

Members
  • Posts

    301
  • Joined

  • Last visited

    Never

Everything posted by Daney11

  1. Could you post a qucik example when you have a spare 5 minutes please. 100% divs dont go to the end of the broswer. i need to add it into body?
  2. Ok. How would i create the background on my website then? So that the top section of my website will have the white and the 10px of dark grey, then the middle second will have the dark grey, and the bottom part of the website will just be white, and that all the text will go into the dark grey and white underneath? Thanks
  3. Hey guys, Please take a look at the attached image. Im using the below code, and the background.png is the attached image. body { background-image: url(../images/background.png); background-repeat: repeat-x; } #wrapper { width: 1000px; margin: 0 auto 0 auto; } Now the image background works fine, however all the content goes in the dark grey area, and when text overlapses the dark grey area, it goes onto the white area.... I need to know how to create the background so that the dark grey streches with the content, and the white will be below the content... Thanks
  4. If anyone else finds that they dont recieve replys. Goto www.sitepoint.com. They will help you.
  5. I guess this is not possible. Thanks anyways for all your replys.
  6. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> <div align="center"> <?php if ((!isset($_GET["Month"])) && (!isset($_GET["Year"]))) { $Month = date("m"); $Year = date("Y"); } else { $Month = $_GET["Month"]; $Year = $_GET["Year"]; } $Timestamp = mktime(0,0,0,$Month,1,$Year); $MonthName = date("F", $Timestamp); ?> <?php echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\">"; echo "<tr><td colspan=\"7\" align=\"left\">Calendar Table for $MonthName, $Year</td></tr>"; echo "<tr bgcolor=\"#999999\">"; $daysOfWeek = array("Sun","Mon","Tue","Wed","Thu","Fri","Sat"); foreach ($daysOfWeek as $value) { echo "<td align=\"center\"><strong><font color=\"#ffffff\">$value</font></strong></td>"; } echo "</tr>"; $MonthStart = date("w", $Timestamp); if ($MonthStart == 0) { // if the month starts on a Sunday $MonthStart = 7; } $LastDay = date("d", mktime(0,0,0,$Month+1, 0, $Year)); $StartDate = -$MonthStart; for ($k=1;$k<=6;$k++){ //print six rows for six possible weeks echo"<tr>"; for ($j=1;$j<=7;$j++){ //seven columns per row $StartDate++; if($StartDate < $LastDay) { //blank calendar space if($StartDate > 0) { echo"<td>$StartDate</td> \n"; } else { echo"<td bgcolor=\"#eeeeee\"></td> \n"; } } elseif (($StartDate <=1) && ($StartDate >= $LastDay)) { //date goes here if($StartDate >= 0) { echo"<td>$StartDate</td> \n"; } } } echo"</tr>"; } //End Table Row echo "</table>"; ?> <hr width="200"> <form action="cal.php" accept-charset="UNKNOWN" enctype="application/x-www-form-urlencoded" method="GET" > <?php echo "<select name=\"Month\">"; for($m=1;$m<=12;$m++){ $selected = ""; $longDate = date("F", mktime(0,0,0,$m,1,$Year)); if ($Month==$m){ $selected = "selected "; } echo "<option value=\"$m\" $selected>$longDate</option> \n"; } echo "</select>"; echo "<select name=\"Year\">"; $yeartoday = date(Y); $yearplus1 = date(Y)+1; for($y=$yeartoday;$y<=$yearplus1;$y++){ $selected = ""; $longDate = date("Y", mktime(0,0,0,1,1,$y)); if ($Year==$y){ $selected = "selected \n"; } echo "<option value=\"$y\" $selected>$longDate</option> \n"; } echo "</select>"; ?> <input type="submit" value="go"> </form> </div> </body> </html> This works. In your above post you missed $ on for($y=yeartoday;$y<=$yearplus1;$y++){ ... yeartoday
  7. Line 83 $yeartoday = date(Y); $yearplus1 = date(Y)+1; for($y=yeartoday;$y<=$yearplus1;$y++){
  8. Ok then, is this even possible to do
  9. Hey guys. I have this peice of code below which creates numbers from 1-99 for each record in my form. Example: Num Name 1 Dane 2 Milk 3 Shake 4 Pig <select name='squad_number[<?php $i; ?>]' class="input"> <?php for ($a=1; $a<=99; $a++) { if($a<10) { $val="$a"; } else { $val=$a; } echo "<option value='$val'"; if ($val==$Squad_PlayerRow['squad_number']) { echo " selected"; } echo ">$val</option>"; } ?> </select> Once submitted, it updates the database setting the relevant fields to the number selected from the form above. However i need to add error checking to it. If, for example: Example: Num Name 1 Dane 2 Milk 1 Shake 4 Pig You will see "Dane" and "Shake" each have the number "1", and i want that to return an error saying that you can not use the same number twice basically. Im using: if (eregi ('^[[:digit:]]{1,2}$', stripslashes(trim($_POST['squad_number'][$i])))) { $squad_number = $_POST['squad_number'][$i]; } else { $squad_number = FALSE; $errors[] = 'Please enter a correct team number.'; } To check if that value in the select menu is actually a number between 1-99, and this works fine. How would i create a error checking to find wether a number has been used twice. Thanks
  10. If the user.. i.e. Myself, has chosen the same number twice from: <select name='squad_number[<?php $i; ?>]' class="input"> <?php for ($a=0; $a<=99; $a++) { if($a<10) { $val="$a"; } else { $val=$a; } echo "<option value='$val'"; if ($val==$Squad_PlayerRow['squad_number']) { echo " selected"; } echo ">$val</option>"; } ?> </select> Num: Name: 1 Dane 2 Milk 3 Cow 1 Pig ^^ Number 1 has been chosen twice, so its wrong. Num: Name: 1 Dane 2 Milk 3 Cow 4 Pig ^^ This would return fine.
  11. There is 1 select box per line in the array. Which is squad_number[$i]. My code works perfectly without error checking. Im just wanting to find a way to check that in the array of squad_number[$i], a same number hasnt been chosen twice...
  12. Basically i have a form with numbers from 0-99. Which is below. <select name='squad_number[<?php $i; ?>]' class="input"> <?php for ($a=0; $a<=99; $a++) { if($a<10) { $val="$a"; } else { $val=$a; } echo "<option value='$val'"; if ($val==$Squad_PlayerRow['squad_number']) { echo " selected"; } echo ">$val</option>"; } ?> </select> And when i click submit it goes to update.php and updates fine without any error checking. However if there are two numbers that are the same in value squad_number[$i] then i want error checking to say that you cannot choose the same number twice. if (eregi ('^[[:digit:]]{1,2}$', stripslashes(trim($_POST['squad_number'][$i])))) { $squad_number = $_POST['squad_number'][$i]; } else { $squad_number = FALSE; $errors[] = 'Please enter a correct team number.'; } if ($_POST['squad_number'][$i] == $_POST['squad_number'][$i]) { $squad_number = FALSE; $errors[] = 'Two players can not have the same number.'; } else { $squad_number = $_POST['squad_number'][$i]; }
  13. Ive got with this aswell if ($_POST['squad_number'][$i] == $_POST['squad_number'][$i]) { $squad_number = FALSE; $errors[] = 'Two players can not have the same number.'; } else { $squad_number = $_POST['squad_number'][$i]; } But it throws up the two players can not error.
  14. Hmm. How would i structure this then? I want it so that two numbers can not equal each other in the array. <select name='squad_number[<?php $i; ?>]' class="input"> <?php for ($a=0; $a<=99; $a++) { if($a<10) { $val="$a"; } else { $val=$a; } echo "<option value='$val'"; if ($val==$Squad_PlayerRow['squad_number']) { echo " selected"; } echo ">$val</option>"; } ?> </select> Thanks
  15. Hey guys. I have a form and when it is submitted it gives each user a number from a drop down menu. However two users are not allowed the same number so im using <?php if (eregi ('^[[:digit:]]{1,2}$', stripslashes(trim($_POST['squad_number'][$i])))) { if ($_POST['squad_number'][$i] != $_POST['squad_number'][$i]) { $squad_number = $_POST['squad_number'][$i]; } else { $squad_number = FALSE; $errors[] = 'Please enter a correct team number.'; } } else { $squad_number = FALSE; $errors[] = 'Two players can not have the same number.'; } ?> However im getting the error. "Please enter a correct team number." Even though each number is different.
  16. Fixed. Needed to change the i value to something different and change if ($val==$Squad_PlayerRow['id']) { to if ($val==$Squad_PlayerRow['squad_number']) {
  17. Basically.... I want to be able to select numbers from 00-99 using a dropdown menu. I have this code below which you can input a number and it works fine and updates all the players within my database. echo "<input type='text' size='10' name='squad_number[$i]' value='{$Squad_PlayerRow['squad_number']}' />"; However, using the below peice of code. The drop down menu shows numbers from 00-99 but does not update all the players in the database. echo "<select name='squad_number[$i]'>"; for ($i=0; $i<=99; $i++) { if($i<10) { $val="0$i"; } else { $val=$i; } echo "<option value='$val'"; if ($val==$Squad_PlayerRow['id']) { echo " selected"; } echo ">$val</option>"; } echo "</select>";
  18. Hey guys. Im having a problem. Using the below code works: <input type='text' size='10' name='squad_number[$i]' value='{$Squad_PlayerRow['squad_number']}' /> However i want to use a dropdown box instead. Using the below code doesnt work: <select name="squad_number[$i]"><?php for ($i=0; $i<=99; $i++) { if($i<10) { $val="0$i"; } else { $val=$i; } echo "<option value=\"$val\""; if ($val==$Squad_PlayerRow['squad_number']) { echo " selected"; } echo ">$val</option>"; } ?></select> Any ideas why the drop down doesnt work? Thanks
  19. change $sql="SELECT * FROM users WHERE username="$_POST['username']" and password='$mypassword'"; to $sql="SELECT * FROM users WHERE username="$username" and password='$mypassword'";
  20. <?php if (isset($_POST['username']) && isset($_POST['password'])) { $username = htmlentities($_POST['username']); $mypassword = htmlentities($_POST['password']); $sql="SELECT * FROM users WHERE username="$_POST['username']" and password='$mypassword'"; $result=mysql_query($sql); if (mysql_num_rows($result) >0 ) { echo "Logged In"; } } ?>
  21. Thanks again for your help. $date1 = strtotime(2009-03-12 12:27:00); $date2 = strtotime(2009-04-12 22:58:00); $dateDiff = $date1 - $date2; $daysRemaining = floor($dateDiff/(60*60*24)); Works, however im getting "-32 Days Remaining" Im not sure where the "-" is coming from. Edited, seen your edited version. Thanks a lot
  22. No, its actually set out in the database as "0000-00-00 00:00:00" and not in seconds.
  23. Hey guys, Im not quite sure on how to get the number of days left from a timestamp in the database 2010-02-20 22:58:00 0 Days Left Any help would be great. Thanks
×
×
  • 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.