Jump to content

Teldosh

Members
  • Posts

    6
  • Joined

  • Last visited

Teldosh's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. ok no problem. $fixture takes todays date then an if statement is ran to check if todays date is less than the upcoming date. if so, then it should load up that page. However it does not check it against 'd m Y' but just by day. Hope that helps clarify what i mean date_default_timezone_set('UTC'); $fixture = date('d-m-Y'); $fixture=date('d-m-Y', strtotime($fixture));; $bury = date('d-m-Y', strtotime("15-02-2014")); $scunthorpe = date('d-m-Y', strtotime("25-02-2014")); $northampton = date('d-m-Y', strtotime("01-03-2014")); $hartlepool = date('d-m-Y', strtotime("15-03-2014")); $fleetwood = date('d-m-Y', strtotime("25-03-2014")); $wimbledon = date('d-m-Y', strtotime("29-04-2014")); $portsmouth = date('d-m-Y', strtotime("19-04-2014")); $wycombe = date('d-m-Y', strtotime("28-04-2014")); if ($fixture <= $bury) {load ('teams/bury.php');} elseif ($fixture <= $scunthorpe) {load ('teams/scunthorpe.php');} elseif ($fixture <= $northampton){load ('teams/northampton.php');} elseif ($fixture <= $hartlepool) {load ('teams/hartlepool.php');} elseif ($fixture <= $fleetwood) {load ('teams/fleetwood.php');} elseif ($fixture <= $wimbledon) {load ('teams/wimbledon.php');} elseif ($fixture <= $portsmouth) {load ('teams/portsmouth.php');} elseif ($fixture <= $wycome) {load ('teams/portsmouth.php');} {echo "No remaining fixtures left for season 2013/2014";}
  2. The title is suppose to say date function. As part of a project, I am trying to create a website that displays details of a football teams away fixtures. I have put dates of the fixtures into variables and would like to display the upcoming game. However, It seems to only check todays date against the fixtures 'day' rather than day - month - year. This means it either loads up the wrong page or does not load any page at all. I've put the code which i have already, does anyone know what i am doing wrong? list($check,$data) = validate ($dbc,$_POST['email'],$_POST['pass']); if ($check) { session_start(); $_SESSION[ 'user_id' ] = $data[ 'user_id' ]; $_SESSION[ 'first_name' ] = $data[ 'first_name' ]; $_SESSION[ 'last_name' ] = $data[ 'last_name' ]; $_SESSION[ 'team' ] = $data[ 'team' ]; $_SESSION[ 'email' ] = $data[ 'email' ]; if (($_SESSION['team']) == 'BR' ) { date_default_timezone_set('UTC'); $fixture = date('d-m-Y'); $fixture=date('d-m-Y', strtotime($fixture));; $bury = date('d-m-Y', strtotime("15-02-2014")); $scunthorpe = date('d-m-Y', strtotime("25-02-2014")); $northampton = date('d-m-Y', strtotime("01-03-2014")); $hartlepool = date('d-m-Y', strtotime("15-03-2014")); $fleetwood = date('d-m-Y', strtotime("25-03-2014")); $wimbledon = date('d-m-Y', strtotime("29-04-2014")); $portsmouth = date('d-m-Y', strtotime("19-04-2014")); $wycombe = date('d-m-Y', strtotime("28-04-2014")); if ($fixture <= $bury) {load ('teams/bury.php');} elseif ($fixture <= $scunthorpe) {load ('teams/scunthorpe.php');} elseif ($fixture <= $northampton){load ('teams/northampton.php');} elseif ($fixture <= $hartlepool) {load ('teams/hartlepool.php');} elseif ($fixture <= $fleetwood) {load ('teams/fleetwood.php');} elseif ($fixture <= $wimbledon) {load ('teams/wimbledon.php');} elseif ($fixture <= $portsmouth) {load ('teams/portsmouth.php');} elseif ($fixture <= $wycome) {load ('teams/portsmouth.php');} {echo "No remaining fixtures left for season 2013/2014";} } else { date_default_timezone_set('UTC'); $fixture = date('d-m-Y'); $fixture=date('d-m-Y', strtotime($fixture));; $orient = date ('d m Y', strtotime("11-02-2014")); $sheffutd = date ('d m Y', strtotime("22-02-2014")); $shrewsbury = date ('d m Y', strtotime("08-03-2014")); $peterborough = date ('d m Y', strtotime("11-03-2014")); $colchester = date ('d m Y', strtotime("22-03-2014")); $rotherham = date ('d m Y', strtotime("29-03-2014")); $walsall = date ('d m Y', strtotime("12-04-2014")); $stevenage = date ('d m Y', strtotime("21-04-2014")); $crawley = date ('d m Y', strtotime("03-05-2014")); if ($fixture <= $orient) {load ('teams/orient.html');} elseif ($fixture <= $sheffutd) {load ('teams/sheffutd.php');} elseif ($fixture <= $shrewsbury) {load ('teams/shrewsbury.php');} elseif ($fixture <= $peterborough) {load ('teams/peterbrough.php');} elseif ($fixture <= $colchester) {load ('teams/colchester.php');} elseif ($fixture <= $rotherham) {load ('teams/rotherham.php');} elseif ($fixture <= $walsall) {load ('teams/walsall.php');} elseif ($fixture <= $stevenage) {load ('teams/stevenage.php');} elseif ($fixture <= $crawley) {load ('teams/crawley.php');} else {echo "No remaining fixtures left for season 2013/2014";} } }
  3. Hi Guys, Can anyone help with a little problem that I cannot solve ? I am displaying some textfields in a for loop. Firstly I need to include htmlspecialchars and make each textfield withing loop sticky. for ($i=1; $i<=$num; $i++) { echo '<input type="text" name="opt_'.$i.')"> '; } This is what I have tried for the specialchars . It did not work. for ($i=1; $i<=$num; $i++){ echo htmlspecialchars( '<input type="text" name="opt_'.$t.')"> '; } Any help or advice would be great
  4. Thanks alot, that solves my problem. I was trying something similar but was not using the seperators so I was just recieving error messages. How can I type an integer into "add_field" and when submitted it adds more textfields?
  5. <form action="test.php" method="POST"> <br> <?php for ($i=1; $i<=6; $i++){ echo $i.'<input type="text" name="option_"> '.'<br>'; } ?> <br> <input type="submit" name="submit" value="submit"> <br><input type="text" size ="2" name="add_field"> <input type="submit" name="add" value="add"> Add extra boxes <?php $select = array(); if ($_POST['submit']){ for ($x = 1; $x<= 6; $x++){ if ($_POST["option_$x"]){ array_push($select, $_POST["option_$x"]); } } if (count($select)){ echo '<br>'.'<br>'.'<br>'."The Decider has choosen: " .'<p>'.$select[rand(0,count($select) - 1)].'</p>'; } } ?> </form> Hi, I have 6 textfeilds and a submit button. When someone enters several values into the textfield and selects submit it will display a random result from one of the 6 textfields. I have also another textfeild and submit button. This is to add more textfields. At the moment it is only displaying the result from the 6th textfield as I do not know how to correctly store the results into an array and also im unsure on how to add extra textfields. can anyone help please?
×
×
  • 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.