Jump to content

PHP syntax - adding references to CSS amongst PHP loop


BarneyJoe

Recommended Posts

I have a page here, that uses a bit of PHP to loop a series of checkboxes.


 


I've posted a screenshot here:


 


http://www.handprintwebdesign.co.uk/gsg_checkboxes/


 


I have the stripes working, but not the rules for the checkboxes so that they don't appear with a border in IE.


 


So I have a couple of rules in my CSS:


 


.tickbox_odd {


          border: 0;


          background-color:#006;


}


.tickbox_even {


          border: 0;


          background-color: #990000;


}


 


And at the moment, the code I have looks like:


 


(the line in bold is the key line)


 


while ($keyword=mysql_fetch_assoc($query)) {


 


 


    //If new category close previous row & display new category


    if ($keyword['Category']!=$current_category) {


        if ($current_category && $column !=1 ) { echo "</tr>\n"; }


        $current_category = $keyword['Category'];


        echo "<tr class=\"categorycell\"><td colspan=\"10\">$current_category</td></tr>\n";


        $column = 1; $row_type="";


    }


 


 


//Create new row if 1st keyword


    if ($column == 1) {


        $row_type = ($row_type=="odd")?"even":"odd";


        echo "<tr class=\"".$row_type."\">";


    }


 


 


    //Display the checkbox


    echo "<td width=\"2%\">";


    echo "<input type=\"checkbox\" class=\"tickbox_".$row_type."\"";


    if (in_array($keyword['ActivityID'],$photokeywords)) { echo " checked"; }


    echo " name=\"ckbox[".$keyword['ActivityID']."]\" id=\"ckbox[".$keyword['ActivityID']."]\">";


    echo "</td>\n";


 


 


    //Display the Keyword


    echo "<td width=\"18%\" align=\"left\">".$keyword['Activity']."</td>\n";


 


 


    //Close the row if 5th keyword OR increase column count


    if ($column == 4) { echo "</tr>"; $column = 1; }


    else { $column++; }


}


 


 


if ($column != 1) { echo "</tr>"; }


 


But that isn't working - any help with this would be appreciated, just to get this detail tidied up.


 


Thank you.

Archived

This topic is now archived and is closed to further replies.

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