Link to home
Start Free TrialLog in
Avatar of usmbay
usmbayFlag for United States of America

asked on

add radiobutton button to a list of template

here a function to display a list of template, and I want to add a radiobutton beside each template to mark it as a defualt

function getListTemplate()
{
      $query = "SELECT tfr.titre as titrefr, ten.titre as titreen, tfr.corps as corpsfr, ten.corps as corpsen, tfr.id as idTemplatefr, ten.id as idTemplateen FROM template as tfr, template as ten WHERE tfr.deleted='n'  AND tfr.idHotel = ".$_SESSION["SES_idHotel"]." AND tfr.idLanguage = 2 AND ten.idLanguage = 1";
      $res = shoot_query($query);

      $i=1;
      while ($row = mysql_fetch_assoc($res))
      {
            $onclick = "parent.ifrCorrespondance.location.href = 'form.php?action=".CORRESPONDANCE_TEMPLATE."&id=".$row["idTemplatefr"]."';
                              parent.ifrTitle.location.href = 'form.php?action=".CORRESPONDANCE_TITLE."&titre=".CORRESPONDANCE_TITLE_TEMPLATE."';
                              parent.document.getElementById('ifrHeader').style.display = 'none';
                              parent.document.getElementById('divResultat').style.display = 'none';
                              parent.document.getElementById('ifrList').style.display = 'none';
                              parent.document.getElementById('ifrLegend').style.display = 'none';
                              parent.document.getElementById('ifrCorrespondance').style.display = 'inline';";
            $color       = ($i%2==0) ? "#F2F2F2" : "white";
            $strFR  = ($row["titrefr"] == "") ?
                          "<TABLE width=\"100%\" cellpadding=\"0\"><TR bgcolor=\"$color\" height=\"100%\"><TD width=\"100%\" align=\"center\"><B>".LB_EMPTY2."</B></TD></TR></TABLE>" :
                          "<TABLE width=\"100%\" cellpadding=\"0\"><TR bgcolor=\"$color\"><TD width=\"2%\">&nbsp;</TD><TD>&nbsp;</TD></TR>".
                          "<TR bgcolor=\"$color\"><TD>&nbsp;</TD><TD><B>".$row["titrefr"]."</B></TD></TR>".
                          "<TR bgcolor=\"$color\"><TD>&nbsp;</TD><TD>".$row["corpsfr"]."</TD></TR>".
                          "<TR bgcolor=\"$color\"><TD colspan=\"2\">&nbsp;</TD></TR></TABLE>";

            $strEN  = ($row["titreen"] == "") ?
                          "<TABLE width=\"100%\" cellpadding=\"0\"><TR bgcolor=\"$color\" height=\"100%\"><TD width=\"100%\" align=\"center\"><B>".LB_EMPTY2."</B></TD></TR></TABLE>" :
                          "<TABLE width=\"100%\" cellpadding=\"0\"><TR bgcolor=\"$color\"><TD width=\"2%\">&nbsp;</TD><TD>&nbsp;</TD></TR>".
                          "<TR bgcolor=\"$color\"><TD>&nbsp;</TD><TD><B>".$row["titreen"]."</B></TD></TR>".
                          "<TR bgcolor=\"$color\"><TD>&nbsp;</TD><TD>".$row["corpsen"]."</TD></TR>".
                          "<TR bgcolor=\"$color\"><TD colspan=\"2\">&nbsp;</TD></TR></TABLE>";

            $str   .= "<TR bgcolor=\"$color\" onclick=\"$onclick\" style=\"cursor: hand;\"><TD width=\"50%\" style=\"border-right: 1 solid silver; border-bottom: 1 solid silver;\" valign=\"middle\">".$strFR."</TD>".
                          "<TD valign=\"middle\" style=\"border-bottom: 1 solid silver;\">".$strEN."</TD></TR>";
            $i++;
      }

      return "<TABLE width=\"100%\" cellpadding=\"0\">$str</TABLE>";
}
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

How do you determine if the record is a default or not?  Will the radio button be expected to do anything other than indicate a default?  (for example, to set a default...)
Avatar of usmbay

ASKER

I will get the value from the select statment
" SELECT tfr.isDefault "
ASKER CERTIFIED SOLUTION
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial