Jump to content

Recommended Posts

I have all error reporting turned on. And no errors are showing. I've been  staring at this code for 2 hours and can't find the error. But the form is blank!  The form shows up with the radio buttons but is blank!

 

Heres the code...

<?php
error_reporting(E_ALL);
?>
<?php
include 'dbc.php';
//-----------------------------------------

$result = mysql_query("SELECT * FROM users ORDER BY nc_points DESC");
while ($row = mysql_fetch_object($result)) {
    $leaderboard[] =  $row->user_name;
$leaderboardPoints[] = $row->cfb_points;
}
$result1 = mysql_query("SELECT  CollegeFootballGames.ID, CollegeFootballGames.Week,  CollegeFootballGames.Away, CollegeFootballGames.Home, CollegeFootballTeams.Team
FROM CollegeFootballGames INNER JOIN CollegeFootballTeams
ON CollegeFootballGames.Away = CollegeFootballTeams.ID || CollegeFootballGames.Home=CollegeFootballTeams.ID");
while ($row = mysql_fetch_object($result1)) {
    $GameID[] = $row->ID;
    	$Teams[] = $row->Team;
}

//----------------------------------------
$date =("now");
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{}

//Form 12
$form12 = ('<h3><em style="color: #F00"> <?php echo $wk;?> <?php echo $wknum;?> </em></h3>
            <form name="Picks" method="post" action="<?php echo $process; ?>">
              <p><br>
		  <input name="P0" type="hidden" value="<?php echo ($p[0]); ?>">
                <label>
                  <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>
		  <input name="P1" type="hidden" value="<?php echo ($p[1]); ?>">
                <label>
                  <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>
		  <input name="P2" type="hidden" value="<?php echo ($p[2]); ?>">
                <label>
                  <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>
		  <input name="P3" type="hidden" value="<?php echo ($p[3]); ?>">
                <label>
                  <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>
		  <input name="P4" type="hidden" value="<?php echo ($p[4]); ?>">
                <br>
                <label>
                  <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>
		  <input name="P5" type="hidden" value="<?php echo ($p[5]); ?>">
                <label>
                  <input type="radio" name="game6" value="<?php echo ($away[5]);?>" >
                  <?php echo ($away[5]);?></label>
                at
                <label>
                  <input type="radio" name="game6" value="<?php echo ($home[5]);?>" >
                  <?php echo ($home[5]);?></label>
                <br>
		  <input name="P6" type="hidden" value="<?php echo ($p[6]); ?>">
                <label>
                  <input type="radio" name="game7" value="<?php echo ($away[6]);?>" >
                  <?php echo ($away[6]);?></label>
                at
                <label>
                  <input type="radio" name="game7" value="<?php echo ($home[6]);?>" >
                 <?php echo ($home[6]);?></label>
                <br>
		  <input name="P7" type="hidden" value="<?php echo ($p[7]); ?>">
                <label>
                  <input type="radio" name="game8" value="<?php echo ($away[7]);?>" >
                 <?php echo ($away[7]);?></label>
                at
                <label>
                  <input type="radio" name="game8" value="<?php echo ($home[7]);?>" >
                  <?php echo ($home[7]);?></label>
                <br>
		  <input name="P8" type="hidden" value="<?php echo ($p[8]); ?>">
                <label>
                  <input type="radio" name="game9" value="<?php echo ($away[8]);?>" >
                  <?php echo ($away[8]);?> </label>
                at
                <label>
                  <input type="radio" name="game9" value="<?php echo ($home[8]);?>" >
                  <?php echo ($home[8]);?></label>
                <br>
		  <input name="P9" type="hidden" value="<?php echo ($p[9]); ?>">
                <label>
                  <input type="radio" name="game10" value="<?php echo ($away[9]);?>" >
                  <?php echo ($away[9]);?> </label>
                at
                <label>
                  <input type="radio" name="game10" value="<?php echo ($home[9]);?>" >
                  <?php echo ($home[9]);?></label>
                <br>
		  <input name="P10" type="hidden" value="<?php echo ($p[10]); ?>">
                <label>
                  <input type="radio" name="game11" value="<?php echo ($away[10]);?>" >
                  <?php echo ($away[10]);?></label>
                at
                <label>
                  <input type="radio" name="game11" value="<?php echo ($home[10]);?>" >
                  <?php echo ($home[10]);?></label>
               <br>
		  <input name="P11" type="hidden" value="<?php echo ($p[11]); ?>">
                <label>
                  <input type="radio" name="game12" value="<?php echo ($away[11]);?>" >
                  <?php echo ($away[11]);?></label>
                at
                <label>
                  <input type="radio" name="game12" value="<?php echo ($home[11]);?>" >
                  <?php echo ($home[11]);?></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_picks_process.php'; 
$away =array("$Teams[0]","$Teams[2]","$Teams[4]","$Teams[6]","$Teams[8]","$Teams[10]","$Teams[12]","$Teams[14]","$Teams[16]","$Teams[18]","$Teams[20]","$Teams[22]"); 
$home =array("$Teams[1]","$Teams[3]","$Teams[5]","$Teams[7]","$Teams[9]","$Teams[11]","$Teams[13]","$Teams[15]","$Teams[17]","$Teams[19]","$Teams[21]","$Teams[23]");
$p = array ("$GameID[0]","$GameID[2]","$GameID[4]","$GameID[6]","$GameID[8]","$GameID[10]","$GameID[12]","$GameID[14]","$GameID[16]","$GameID[18]","$GameID[20]","$GameID[22]");}

elseif ( strtotime($date) > strtotime('6 September 2010') && strtotime($date) < strtotime('11 September 2010')){$wknum = '2';$formDisplay = $form12; $wk = "Week";$process = 'cfb_picks_process.php';
$away =array("$Teams[24]","$Teams[26]","$Teams[28]","$Teams[30]","$Teams[33]","$Teams[34]","$Teams[36]","$Teams[38]","$Teams[40]","$Teams[42]","$Teams[44]","$Teams[46]"); 
$home =array("$Teams[25]","$Teams[27]","$Teams[29]","$Teams[31]","$Teams[32]","$Teams[35]","$Teams[37]","$Teams[39]","$Teams[41]","$Teams[43]","$Teams[45]","$Teams[47]");
$p = array ("$GameID[24]","$GameID[26]","$GameID[28]","$GameID[30]","$GameID[32]","$GameID[34]","$GameID[36]","$GameID[38]","$GameID[40]","$GameID[42]","$GameID[44]","$GameID[46]");
}


elseif ( strtotime($date) > strtotime('11 September 2010') && strtotime($date) < strtotime('16 September 2010')){$wknum = '3';$formDisplay = $form12; $wk = "Week";$process = 'cfb_picks_process.php';
$away =array("$Teams[49]","$Teams[50]","$Teams[52]","$Teams[55]","$Teams[56]","$Teams[58]","$Teams[61]","$Teams[62]","$Teams[64]","$Teams[66]","$Teams[68]","$Teams[70]"); 
$home =array("$Teams[48]","$Teams[51]","$Teams[53]","$Teams[54]","$Teams[57]","$Teams[59]","$Teams[60]","$Teams[63]","$Teams[65]","$Teams[67]","$Teams[69]","$Teams[71]");
$p = array ("$GameID[48]","$GameID[50]","$GameID[52]","$GameID[54]","$GameID[56]","$GameID[58]","$GameID[60]","$GameID[62]","$GameID[64]","$GameID[66]","$GameID[68]","$GameID[70]");
}

elseif ( strtotime($date) > strtotime('18 September 2010') && strtotime($date) < strtotime('23 September 2010')){$wknum = '4';$formDisplay = $form12; $wk = "Week";$process = 'cfb_picks_process.php';
$away =array("$Teams[72]","$Teams[74]","$Teams[76]","$Teams[78]","$Teams[80]","$Teams[83]","$Teams[85]","$Teams[87]","$Teams[88]","$Teams[91]","$Teams[92]","$Teams[94]"); 
$home =array("$Teams[73]","$Teams[75]","$Teams[77]","$Teams[79]","$Teams[81]","$Teams[82]","$Teams[84]","$Teams[86]","$Teams[89]","$Teams[90]","$Teams[93]","$Teams[95]");
$p = array ("$GameID[72]","$GameID[74]","$GameID[76]","$GameID[78]","$GameID[80]","$GameID[82]","$GameID[84]","$GameID[86]","$GameID[88]","$GameID[90]","$GameID[92]","$GameID[94]");
}

elseif ( strtotime($date) > strtotime('25 September 2010') && strtotime($date) < strtotime('2 October 2010')){$wknum = '5';$formDisplay = $form12; $wk = "Week";$process = 'cfb_picks_process.php';
/*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); 
$home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]");
$p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]");
*/}

elseif ( strtotime($date) > strtotime('2 October 2010') && strtotime($date) < strtotime('9 October 2010')){$wknum = '6';$formDisplay = $form12; $wk = "Week";$process = 'cfb_picks_process.php';
/*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); 
$home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]");
$p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]");
*/}

elseif ( strtotime($date) > strtotime('9 October 2010') && strtotime($date) < strtotime('16 October 2010')){$wknum = '7';$formDisplay = $form12;$wk = "Week";$process = 'cfb_picks_process.php';
/*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); 
$home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]");
$p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]");
*/}

elseif ( strtotime($date) > strtotime('16 October 2010') && strtotime($date) < strtotime('23 October 2010')){$wknum = '8';$formDisplay = $form12;$wk = "Week";$process = 'cfb_picks_process.php';
/*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); 
$home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]");
$p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]");
*/}

elseif ( strtotime($date) > strtotime('23 October 2010') && strtotime($date) < strtotime('28 October 2010')){$wknum = '9';$formDisplay = $form12;$wk = "Week";$process = 'cfb_picks_process.php';
/*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); 
$home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]");
$p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]");
*/}

elseif ( strtotime($date) > strtotime('30 October 2010') && strtotime($date) < strtotime('4 November 2010')){$wknum = '10';$formDisplay = $form12;$wk = "Week";$process = 'cfb_picks_process.php';
/*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); 
$home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]");
$p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]");
*/}

elseif ( strtotime($date) > strtotime('6 November 2010') && strtotime($date) < strtotime('13 November 2010')){$wknum = '11';$formDisplay = $form12;$wk = "Week";$process = 'cfb_picks_process.php';
/*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); 
$home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]");
$p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]");
*/}

elseif ( strtotime($date) > strtotime('13 November 2010') && strtotime($date) < strtotime('20 November 2010')){$wknum = '12';$formDisplay = $form12;$wk = "Week";$process = 'cfb_picks_process.php';
/*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); 
$home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]");
$p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]");
*/}

elseif ( strtotime($date) > strtotime('20 November 2010') && strtotime($date) < strtotime('27 November 2010')){$wknum = '13';$formDisplay = $form12;$wk = "Week";$process = 'cfb_picks_process.php';
/*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); 
$home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]");
$p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]");
*/}

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 users ORDER BY nc_points DESC");
while ($row = mysql_fetch_object($result)) {
    $leaderboard[] =  $row->user_name;
$leaderboardPoints[] = $row->cfb_points;
}
$result1 = mysql_query("SELECT  CollegeFootballGames.ID, CollegeFootballGames.Week,  CollegeFootballGames.Away, CollegeFootballGames.Home, CollegeFootballTeams.Team
FROM CollegeFootballGames INNER JOIN CollegeFootballTeams
ON CollegeFootballGames.Away = CollegeFootballTeams.ID || CollegeFootballGames.Home=CollegeFootballTeams.ID");
while ($row = mysql_fetch_object($result1)) {
    $GameID[] = $row->ID;
    	$Teams[] = $row->Team;
}
?>

<?
echo $formDisplay;
?>

 

If you see what is wrong please tell me.

Link to comment
https://forums.phpfreaks.com/topic/209440-what-is-wrong/
Share on other sites

Then my guess is that one or more of the queries is failing (or simply not producing any results). You have no error checking for your query execution, and you can't even echo the query strings to see if they have the values they should have until you separate the strings from the executions.

 

$query = "SELECT whatever FROM table";
$result = mysql_query( $query ) or die( '<br />Query string: ' . $query . '<br />Produced error: ' . mysql_error() . '<br />'  ;

Link to comment
https://forums.phpfreaks.com/topic/209440-what-is-wrong/#findComment-1093552
Share on other sites

When you view source it shows this....

<h3><em style="color: #F00"> <?php echo $wk;?> <?php echo $wknum;?> </em></h3>
            <form name="Picks" method="post" action="<?php echo $process; ?>">
              <p><br>
		  <input name="P0" type="hidden" value="<?php echo ($p[0]); ?>">
                <label>
                  <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>
		  <input name="P1" type="hidden" value="<?php echo ($p[1]); ?>">
                <label>
                  <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>
		  <input name="P2" type="hidden" value="<?php echo ($p[2]); ?>">
                <label>
                  <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>
		  <input name="P3" type="hidden" value="<?php echo ($p[3]); ?>">
                <label>
                  <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>
		  <input name="P4" type="hidden" value="<?php echo ($p[4]); ?>">
                <br>
                <label>
                  <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>
		  <input name="P5" type="hidden" value="<?php echo ($p[5]); ?>">
                <label>
                  <input type="radio" name="game6" value="<?php echo ($away[5]);?>" >
                  <?php echo ($away[5]);?></label>
                at
                <label>
                  <input type="radio" name="game6" value="<?php echo ($home[5]);?>" >
                  <?php echo ($home[5]);?></label>
                <br>
		  <input name="P6" type="hidden" value="<?php echo ($p[6]); ?>">
                <label>
                  <input type="radio" name="game7" value="<?php echo ($away[6]);?>" >
                  <?php echo ($away[6]);?></label>
                at
                <label>
                  <input type="radio" name="game7" value="<?php echo ($home[6]);?>" >
                 <?php echo ($home[6]);?></label>
                <br>
		  <input name="P7" type="hidden" value="<?php echo ($p[7]); ?>">
                <label>
                  <input type="radio" name="game8" value="<?php echo ($away[7]);?>" >
                 <?php echo ($away[7]);?></label>
                at
                <label>
                  <input type="radio" name="game8" value="<?php echo ($home[7]);?>" >
                  <?php echo ($home[7]);?></label>
                <br>
		  <input name="P8" type="hidden" value="<?php echo ($p[8]); ?>">
                <label>
                  <input type="radio" name="game9" value="<?php echo ($away[8]);?>" >
                  <?php echo ($away[8]);?> </label>
                at
                <label>
                  <input type="radio" name="game9" value="<?php echo ($home[8]);?>" >
                  <?php echo ($home[8]);?></label>
                <br>
		  <input name="P9" type="hidden" value="<?php echo ($p[9]); ?>">
                <label>
                  <input type="radio" name="game10" value="<?php echo ($away[9]);?>" >
                  <?php echo ($away[9]);?> </label>
                at
                <label>
                  <input type="radio" name="game10" value="<?php echo ($home[9]);?>" >
                  <?php echo ($home[9]);?></label>
                <br>
		  <input name="P10" type="hidden" value="<?php echo ($p[10]); ?>">
                <label>
                  <input type="radio" name="game11" value="<?php echo ($away[10]);?>" >
                  <?php echo ($away[10]);?></label>
                at
                <label>
                  <input type="radio" name="game11" value="<?php echo ($home[10]);?>" >
                  <?php echo ($home[10]);?></label>
               <br>
		  <input name="P11" type="hidden" value="<?php echo ($p[11]); ?>">
                <label>
                  <input type="radio" name="game12" value="<?php echo ($away[11]);?>" >
                  <?php echo ($away[11]);?></label>
                at
                <label>
                  <input type="radio" name="game12" value="<?php echo ($home[11]);?>" >
                  <?php echo ($home[11]);?></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>

 

 

Which means that for some reason or another its not processing the <?php ?> stuff!

 

Anybody know why?

Link to comment
https://forums.phpfreaks.com/topic/209440-what-is-wrong/#findComment-1093556
Share on other sites

I see you've tried to store that whole block of html in a variable as well. It looks as thought it's going to be an issue of it being enclosed in single quotes, and being interpreted as one literal string. The variables and <?php tags aren't being interpreted.

Link to comment
https://forums.phpfreaks.com/topic/209440-what-is-wrong/#findComment-1093559
Share on other sites

I'm going to guess that someone already pointed out in one of your other threads for this application, why that part of the code does not work, so I won't revisit it.

 

As to your question - What is wrong? -

 

A) Once you fix why the php code in your form is not working (you should just be putting php variables in because it is already php code, i.e. a php string), you must know that php variables are evaluated at the time they are referenced and you would need to put your $form12 = "... ..."; code after the point where you have assigned the correct values to each variable.

 

B) You should be storing the weekly game/team/date information in your table instead of hard-coding it in php logic. Then you would simply retrieve the information that you want in the order that you want it and iterate over it to display it. You will find that by properly organizing your data and using your database to hold the relevant data that your code will be reduced to almost nothing and it will take you a very short time to complete this application. Doing it the why you are attempting now will take a minimum of 20 times longer to produce the application just because of all the code you are writing and all the copy/paste/over-typing and typo errors you must find and fix.

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/209440-what-is-wrong/#findComment-1093561
Share on other sites

Ya this is like my fifth try at this. Over the past month or so. I have taken the advice of using multiple tables and my code has gotten smaller. But i don't fully understand everything your saying. The only data thats not stored in my tables is the actual dates for each week. Everything else is.

 

Thanks for your suggestions

Link to comment
https://forums.phpfreaks.com/topic/209440-what-is-wrong/#findComment-1093566
Share on other sites

You don't have to open a PHP tag when you're already inside a PHP tag.

 

Example.  In your code you're doing this

//bunch of strtotime codes....
/more code
//blah blah
$variable = "something something ";
?>

 

When you should just be doing this... in your variable declaration

$variable = "something something $wknum";

or this

$variable = "something something {$wknum}";

 

No reason to use the echo function within a variable's value.  That would be like Preprocessing Preprocessed PHP

Link to comment
https://forums.phpfreaks.com/topic/209440-what-is-wrong/#findComment-1093570
Share on other sites

I see you've tried to store that whole block of html in a variable as well. It looks as thought it's going to be an issue of it being enclosed in single quotes, and being interpreted as one literal string. The variables and <?php tags aren't being interpreted.

 

Did you address this also? ^^

Link to comment
https://forums.phpfreaks.com/topic/209440-what-is-wrong/#findComment-1093573
Share on other sites

It sounds like your database tables have or almost have everything you need.

 

The goal for your code should be some simple code to retrieve the data you want for any time period (or week number) and simply iterate over it to display it the way you want. You should NOT have 13 sets of unique if/elseif statements that define which teams play each other each week, that information should already be in your database tables.

 

If you post your current structure/definition of your tables along with a small amount of sample data (~ four rows for each table would be enough), someone can probably provide better/specific help.

 

I would also add, that if you are using the week number as your main key for labeling/storing/retrieving information, you should probably have a database table that relates the week number to the actual start/end dates.

Link to comment
https://forums.phpfreaks.com/topic/209440-what-is-wrong/#findComment-1093580
Share on other sites

That was my point. It should NOT be in single quotes, which it currently is. It should be in double quotes, with all the enclosed double quotes escaped. Note the syntax highlighting.

 

$form12 = ('<h3><em style="color: #F00"> <?php echo $wk;?> <?php echo $wknum;?> </em></h3>
            <form name="Picks" method="post" action="<?php echo $process; ?>">

//       {SNIP}

              </p>
            </form>');

 

 

$form12 = "<h3><em style=\"color: #F00\"> <?php echo $wk;?> <?php echo $wknum;?> </em></h3>
            <form name=\"Picks\" method=\"post\" action=\"<?php echo $process; ?>\">

//       {SNIP}

              </p>
            </form>";

Link to comment
https://forums.phpfreaks.com/topic/209440-what-is-wrong/#findComment-1093582
Share on other sites

As to your current form problem, you need to use overall double-quotes when you form the string. You can then simply put php variables into the string (and as I posted, the $form12 = "... ..."; code must be located after the point where the variables are set) -

 

$form12 = "<h3><em style=\"color: #F00\">$wk $wknum</em></h3>
            <form name=\"Picks\" method=\"post\" action=\"$process\"> .... the rest of your form ... ending with a double-quote";

 

You could also use the Heredoc string syntax if you want to avoid escaping all the double-quotes inside of the double-quoted string.

 

Link to comment
https://forums.phpfreaks.com/topic/209440-what-is-wrong/#findComment-1093584
Share on other sites

CollegeFootballPicks

 

ID

User_ID

Game_ID

Pick

 

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

CollegeFootballGames

 

ID

Week

Away

Home

 

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

CollegeFootball Teams

 

ID

Team

 

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

users

 

id

user_name

pass

 

ect.

 

 

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

Thats the table set up

Link to comment
https://forums.phpfreaks.com/topic/209440-what-is-wrong/#findComment-1093585
Share on other sites

Ok, this should work

$form12 = "{$wk . $wknum}
            </pre>
<form name="'Picks'" method="'post'" action="'%7B%24process%7D'">
  				
                
                  
                  {$away[0]}
                at
                
                  
                  {$home[0]}

  				
                
                  
                  {$away[1]}
                at
                
                  
                  {$home[1]}


                
                  
                  {$away[2]}
                at
                
                  
                  {$home[2]}


                
                  
                  {$away[3]} 
                at
                
                  
                 {$home[3]}

                

                
                  
                  {$away[4]}
                at
                
                  
                 {$home[4]}
                


                
                  
                  {$away[5]}
                at
                
                  
                  {$home[5]}
                


                
                  
                  {$away[6]}
                at
                
                  
                 {$home[6]}
                


                
                  
                 {$away[7]}
                at
                
                  
                  {$home[7]}
                

  				
                
                  
                  {$away[8]} 
                at
                
                  
                  {$home[8]}
                

  				
                
                  
                  {$away[9]} 
                at
                
                  
                  {$home[9]}
                

  				
                
                  
                  {$away[10]}
                at
                
                  
                  {$home[10]}
               

  				
                
                  
                  {$away[11]}
                at
                
                  
                  {$home[11]}

                

                
                  
                
                
                  
                
                

            </form>

Link to comment
https://forums.phpfreaks.com/topic/209440-what-is-wrong/#findComment-1093587
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.