I am extremely grateful of your help with my Top 25 prediction form last year. You have saved me a lot of time setting those up each week. Now I am attempting to get the same set up on the new versions of CF and CC. I'm having one small issue that I cannot seem to tackle and since you wrote the code, I thought you might be able to help.
The part I'm having trouble with is the connection part that serves as a confirmation page for form results. I have simply used the form to display the results with some small changes. Below is part of the code from the form you wrote with what I've added in bold.
All of the variables populate correctly but the conditional statements that I added in bold do not display correctly in the form. The $label_away and $label_home variables always show up the same no matter what I've tried(four hrs worth😲). Either both label classes show up "checked" or both show up "unchecked" but they should always be the opposite.
<?php
function buildGame($game, $count, $teams)
{
global $mainframe;
if ( !count($game) ) {
return false;
}
$away = $teams[$game->away];
$home = $teams[$game->home];
$away_logo = strtolower($game->away);
$home_logo = strtolower($game->home);
if ( !$game->conf ) {
$game->conf = $game->number;
}
if ( $game->conf % 2 ) {
$tr_class = 'even';
} else {
$tr_class = 'odd';
}
$rowspan = '';
if ( $game->margin || ($game->number == $count && !$game->win ) ) {
$rowspan = 'rowspan="2"';
}
$tabindex_away = $game->conf * 2 - 1;
$tabindex_home = $game->conf * 2;
if ( $game->away == "{game_{$game->number}}" ) {
$label_away = 'checked';
} else {
$label_away = 'unchecked';
}
if ( $game->home == "{game_{$game->number}}" ) {
$label_home = 'checked';
} else {
$label_home = 'unchecked';
}
echo "<div id='game_div_{$game->number}' class='switch' >
<table>
<tbody>
<tr class='{$tr_class} game' id='game_{$game->number}' >
<td class='game-number' {$rowspan} >Game {$game->number}</td>
<td class='logo'>
<img src='http://nc2apredictions.com/images/logos/teams/{$away_logo}.gif' alt='{$away_logo}' />
</td>
<td class='team team_away'><span class='rank'>{$away->rank}</span>{$away->name}</td>
<td class='radios'>
<label class='{$label_away}'>
</label>
</td>
<td class='confidence' >
{game_{$game->number}_confidence}
</td>
<td class='radios'>
<label class='{$label_home}'>
</label>
</td>
<td class='team team_home'><span class='rank'>{$home->rank}</span>{$home->name}</td>
<td class='logo logo_home'>
<img src='http://nc2apredictions.com/images/logos/teams/{$home_logo}.gif' alt='{$home_logo}' />
</td>
<td class='right-end' {$rowspan} ></td>
</tr>";
if ( $game->number == $count ) {
$tabindex = $tabindex_home + 1;
echo " <tr class='{$tr_class} bonus'>
<td colspan='9' class='team-away-bonus-mg bonus'><span class='margin'>Margin of Victory
<input name='game_margin' type='text'
tabindex='{$tabindex}' size='2' maxlength='2' value='{$game->margin}' /></span></td>
</tr>
";
}
echo " </tbody>
</table>
</div>";
}
?>
The only thing I can think of for why it won't work is because the {game_{$game->number}} syntax from CC won't load the form result in an IF statement because it loads correctly if I place them in the table. I have a formhtml file loaded in the body section of the custom code box which I can attach if you need it. thanks again for all your help.
John