Jump to content

Recommended Posts

Heres my current code...

<?php
//----------------------------------------
$date =("17 October 2010");
if ( strtotime($date) > strtotime('18 July 2010') && strtotime($date) < strtotime('2 September 2010')){$wknum = '1'; $wk = "Week";}
elseif ( strtotime($date) > strtotime('6 September 2010') && strtotime($date) < strtotime('11 September 2010')){$wknum = '2';  $wk = "Week";}
elseif ( strtotime($date) > strtotime('11 September 2010') && strtotime($date) < strtotime('16 September 2010')){$wknum = '3';  $wk = "Week";}
elseif ( strtotime($date) > strtotime('18 September 2010') && strtotime($date) < strtotime('23 September 2010')){$wknum = '4';  $wk = "Week";}
elseif ( strtotime($date) > strtotime('25 September 2010') && strtotime($date) < strtotime('2 October 2010')){$wknum = '5';  $wk = "Week";}
elseif ( strtotime($date) > strtotime('2 October 2010') && strtotime($date) < strtotime('9 October 2010')){$wknum = '6';  $wk = "Week";}
elseif ( strtotime($date) > strtotime('9 October 2010') && strtotime($date) < strtotime('16 October 2010')){$wknum = '7'; $wk = "Week";}
elseif ( strtotime($date) > strtotime('16 October 2010') && strtotime($date) < strtotime('23 October 2010')){$wknum = '8'; $wk = "Week";}
elseif ( strtotime($date) > strtotime('23 October 2010') && strtotime($date) < strtotime('28 October 2010')){$wknum = '9'; $wk = "Week";}
elseif ( strtotime($date) > strtotime('30 October 2010') && strtotime($date) < strtotime('4 November 2010')){$wknum = '10'; $wk = "Week";}
elseif ( strtotime($date) > strtotime('6 November 2010') && strtotime($date) < strtotime('13 November 2010')){$wknum = '11'; $wk = "Week";}
elseif ( strtotime($date) > strtotime('13 November 2010') && strtotime($date) < strtotime('20 November 2010')){$wknum = '12'; $wk = "Week";}
elseif ( strtotime($date) > strtotime('20 November 2010') && strtotime($date) < strtotime('27 November 2010')){$wknum = '13'; $wk = "Week";}
else{$formDisplay = $wk = " "; }

//Form 5
$form5 = ('<h3><em style="color: #F00"> <?php echo $wk;?> <?php echo $wknum;?> </em></h3>
            <form name="Picks" method="post" action="<?php echo $process; ?>">
              <p><br>
                <label>
			  <input name="ACC_Game_ID1" type="hidden" value="<php echo ($id[0]); ?>">
                  <input type="radio" name="game1" value="<?php echo ($away[0]);?>" >
                  <?php echo ($away[0]);?></label>
                at
                <label>
                  <input type="radio" name="game1" value="<?php echo ($home[0]);?>" >
                  <?php echo ($home[0]);?></label>
                <br>
                <label>
                <input name="ACC_Game_ID2" type="hidden" value="<php echo ($id[1]); ?>">
			<input type="radio" name="game2" value="<?php echo ($away[1]);?>" >
                  <?php echo ($away[1]);?></label>
                at
                <label>
                  <input type="radio" name="game2" value="<?php echo ($home[1]);?>" >
                  <?php echo ($home[1]);?></label>
			  <br>
                <label>
			<input name="ACC_Game_ID3" type="hidden" value="<php echo ($id[2]); ?>">
                  <input type="radio" name="game3" value="<?php echo ($away[2]);?>" >
                  <?php echo ($away[2]);?></label>
                at
                <label>
                  <input type="radio" name="game3" value="<?php echo ($home[2]);?>" >
                  <?php echo ($home[2]);?></label>
                <br>
                <label>
			<input name="ACC_Game_ID4" type="hidden" value="<php echo ($id[3]); ?>">
                  <input type="radio" name="game4" value="<?php echo ($away[3]);?>" >
                  <?php echo ($away[3]);?> </label>
                at
                <label>
                  <input type="radio" name="game4" value="<?php echo ($home[3]);?>" >
                 <?php echo ($home[3]);?></label>
                <br>
                <label>
			<input name="ACC_Game_ID5" type="hidden" value="<php echo ($id[4]); ?>">
                  <input type="radio" name="game5" value="<?php echo ($away[4]);?>" >
                  <?php echo ($away[4]);?></label>
                at
                <label>
                  <input type="radio" name="game5" value="<?php echo ($home[4]);?>" >
                 <?php echo ($home[4]);?></label>
                <br>
                <br>
                <label>
                  <input type="reset" name="button" id="button" value="Reset">
                </label>
                <label>
                  <input type="submit" name="button2" id="button2" value="Submit">
                </label>
                <br>
              </p>
            </form>');

if ( strtotime($date) > strtotime('18 July 2010') && strtotime($date) < strtotime('2 September 2010')){$wknum = '1'; $formDisplay = $form12; $wk = "Week"; $process = 'cfb_acc_picks_process.php';}
elseif ( strtotime($date) > strtotime('6 September 2010') && strtotime($date) < strtotime('11 September 2010')){$wknum = '2';$formDisplay = $form10; $wk = "Week";$process = 'cfb_acc_picks_process.php';$ACC_Game_ID= $id;}
elseif ( strtotime($date) > strtotime('11 September 2010') && strtotime($date) < strtotime('16 September 2010')){$wknum = '3';$formDisplay = $form8; $wk = "Week";$process = 'cfb_acc_picks_process.php';$ACC_Game_ID= $id;}
elseif ( strtotime($date) > strtotime('18 September 2010') && strtotime($date) < strtotime('23 September 2010')){$wknum = '4';$formDisplay = $form8; $wk = "Week";$process = 'cfb_acc_picks_process.php';$ACC_Game_ID= $id;}
elseif ( strtotime($date) > strtotime('25 September 2010') && strtotime($date) < strtotime('2 October 2010')){$wknum = '5';$formDisplay = $form7; $wk = "Week";$process = 'cfb_acc_picks_process.php';$ACC_Game_ID= $id;}
elseif ( strtotime($date) > strtotime('2 October 2010') && strtotime($date) < strtotime('9 October 2010')){$wknum = '6';$formDisplay = $form6; $wk = "Week";$process = 'cfb_acc_picks_process.php';$ACC_Game_ID= $id;}
elseif ( strtotime($date) > strtotime('9 October 2010') && strtotime($date) < strtotime('16 October 2010')){$wknum = '7';$formDisplay = $form7;$wk = "Week";$process = 'cfb_acc_picks_process.php';$ACC_Game_ID= $id;}
elseif ( strtotime($date) > strtotime('16 October 2010') && strtotime($date) < strtotime('23 October 2010')){$wknum = '8';$formDisplay = $form5;$wk = "Week";$process = 'cfb_acc_picks_process.php';$ACC_Game_ID= $id;}
elseif ( strtotime($date) > strtotime('23 October 2010') && strtotime($date) < strtotime('28 October 2010')){$wknum = '9';$formDisplay = $form6;$wk = "Week";$process = 'cfb_acc_picks_process.php';$ACC_Game_ID= $id;}
elseif ( strtotime($date) > strtotime('30 October 2010') && strtotime($date) < strtotime('4 November 2010')){$wknum = '10';$formDisplay = $form6;$wk = "Week";$process = 'cfb_acc_picks_process.php';$ACC_Game_ID= $id;}
elseif ( strtotime($date) > strtotime('6 November 2010') && strtotime($date) < strtotime('13 November 2010')){$wknum = '11';$formDisplay = $form6;$wk = "Week";$process = 'cfb_acc_picks_process.php';$ACC_Game_ID= $id;}
elseif ( strtotime($date) > strtotime('13 November 2010') && strtotime($date) < strtotime('20 November 2010')){$wknum = '12';$formDisplay = $form6;$wk = "Week";$process = 'cfb_acc_picks_process.php';$ACC_Game_ID= $id;}
elseif ( strtotime($date) > strtotime('20 November 2010') && strtotime($date) < strtotime('27 November 2010')){$wknum = '13';$formDisplay = $form9;$wk = "Week";$process = 'cfb_acc_picks_process.php';$ACC_Game_ID= $id;}
else{$formDisplay = $wk = " "; $formDisplay = ("<br><br><h2>Picks For this week are final!</h2> <br><br><br> Check Back Later To Make Your Picks For Next Week");}

$result = mysql_query("SELECT * FROM ACC_Games_Table WHERE Week_Number='$wknum'");
while ($row = mysql_fetch_object($result)) {
    	$away[] =  $row->Away;
	$home[] =  $row->Home;
}
$result = mysql_query("SELECT * FROM ACC_Games_Table WHERE Away='$away'");
while ($row = mysql_fetch_object($result)) {
	$id[] = $row->ACC_Game_ID;
}

 

Heres my purpose...

Depending on the date it shows different forms. And also depending on the week number it shows different match ups.

 

Hers my problem...

 

I need for with each match up (it to be hidden on the form but still attached for later mysql stuff) the games id number.

 

I need help with somehow depending on the teams determine what the game id is (because  when the form is processed im going to pull the id number with which team was picked to be published to a mysql table).

 

 

 

mySQL tables

----------------

ACC_Games_Table

      Fields

      ------

          ACC_Game_ID

          Week_Number

          Away

          Home

 

CFB_Picks_Table

      Fields

      ------

          Pick_ID

          User_ID

          ACC_Game_ID

          User_Pick

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/208857-help/
Share on other sites

Well im pretty new to php and thats the way I know, so unless your gonna elaborate onto a more efficient way. That wasn't what I asked ,I asked for help in a help forum, not for an opinion of my code by somebody who thinks they know it all.

 

Who says I know it all? No need to troll me. Gosh I have feelings ya know? Jerk.

 

;(

Link to comment
https://forums.phpfreaks.com/topic/208857-help/#findComment-1091005
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.