hi guys..can guys tell me how to make a display for checkbox after checked. the checkbox is checked and i want to display that checkbox? i'm not good in any statement..:'( hopefully u guys can help me..sory for bad english..

Recommended Answers

<input type="checkbox" name="param" value="param" <?php if( $value == 'param' ){echo 'checked="checked"';} ?> />

or just

<input type="checkbox" name="param" value="param" checked="checked" />
Jump to Post

All 4 Replies

<input type="checkbox" name="param" value="param" <?php if( $value == 'param' ){echo 'checked="checked"';} ?> />

or just

<input type="checkbox" name="param" value="param" checked="checked" />

SIR gabrielcastillo..THANKS..I GET IT..BUT I HAVE A FEW QUESTION MORE NEED TO ASK..

1) how to make to display for checkbox after checked..i have a form for checkbox..it should be tick by user then it will insert into database...what i want is just to display that checbox name(description) only? how to make it?(IN IF ELSE STATEMENT OR OTHER.)

# i have 2 tables in database. one for checkbox to check the value eg: if user tick it will be "1"..if not it will be "0" and the other for the name of checkbox..the name of checkbox for table 2 i used "code and name".. how to call it because i have many names more than 10 checkbox actually a name of dokument for my system. each assigned a different value.

2) my next question how to make the checkbox is update in database by using the same ID..i mean..still using the same ID..but if we use the same ID, just want the other data changed in the database...the current data still remain and doesn't changed..just want it can insert new data but still hold the same ID..how to make it?

Can We look at the code you have so far?

Sir gabrielcastillo :

all this code in one page

my code for display the checkbox (i don't know it is true or not because before this i'm doing for display data, i'm doing like this way)

<?php

    $sql22= "SELECT * FROM "" WHERE "" = '' ";

    //$sql3 = "SELECT * FROM ""  WHERE "" = 'IC2'  ";


    $result22 = mysql_query($sql22);
    $row22 = mysql_fetch_array($result22);


    $BMK81A = $row22['BMK81A'];
    $BMK81 = $row22['BMK81'];
    $DL3 = $row22['DL3'];
    $DL2 = $row22['DL2'];
    $DL1 = $row22['DL1'];
    $S1 = $row22['S1'];
    $S2 = $row22['S2'];
    $S3 = $row22['S3'];
    $S4 = $row22['S4'];
    $S5 = $row22['S5'];
    $S6 = $row22['S6'];
    $S7 = $row22['S7'];
    $D1 = $row22['D1'];
    $A1 = $row22['A1'];
    $RE1= $row22['RE1'];
    $LU2 = $row22['LU2'];
    $NPT = $row22['NPT'];
    $SRP = $row22['SRP'];
    $KTDP = $row22['KTDP'];
    $KDP = $row22['KDP'];
    $USPD = $row22['USPD'];


?>

my second code is to display the row of checkbox..but it didn't work..before this when i'm doing this way..it working! it can display what i want..

 <tr>
          <td width="3" height="33" bgcolor="#A4DDED">&nbsp;</td>

          <td width="750" bgcolor="#A4DDED">


          <?php 
            //$sql="SELECT * FROM  "" WHERE ""= '$IC2' ";
        //$result = mysql_query($sql);
        //$row = mysql_fetch_array ($result);
            echo $row22['BMK81A']; 
             ?></td>
        </tr>

        <tr>
          <td height="37" bgcolor="#A4DDED" class="style21"></td>

         <td bgcolor="#A4DDED" class="style21"><?php 
            //$sql="SELECT * FROM  "" WHERE ""= '$IC2' ";
        //$result = mysql_query($sql);
        //$row = mysql_fetch_array ($result);
            echo $row22['BMK81']; 
             ?></td>
         </tr>

          <tr>
          <td height="37" bgcolor="#A4DDED" class="style21"></td>

           <td bgcolor="#A4DDED" class="style21"><?php 
            //$sql="SELECT * FROM  "" WHERE ""= '$IC2' ";
        //$result = mysql_query($sql);
        //$row = mysql_fetch_array ($result);
            echo $row22['DL3']; 
             ?></td>
          </tr>


        <tr>
          <td height="36" bgcolor="#A4DDED" class="style21"></td>

          <td bgcolor="#A4DDED"><?php 
            //$sql="SELECT * FROM  "" WHERE ""= '$IC2' ";
        //$result = mysql_query($sql);
        //$row = mysql_fetch_array ($result);
            echo $row22['DL2']; 
             ?></td>
   </tr>



       <tr>
          <td height="36" bgcolor="#A4DDED" class="style21"></td>

          <td bgcolor="#A4DDED"><?php 
            //$sql="SELECT * FROM  "" WHERE ""= '$IC2' ";
        //$result = mysql_query($sql);
        //$row = mysql_fetch_array ($result);
            echo $row22['DL1']; 
             ?></td>
   </tr>



       <tr>
          <td height="48" bgcolor="#A4DDED" class="style21"></td>

          <td bgcolor="#A4DDED"><?php 
            //$sql="SELECT * FROM  "" WHERE ""= '$IC2' ";
        //$result = mysql_query($sql);
        //$row = mysql_fetch_array ($result);
            echo $row22['S1']; 
             ?></td>
   </tr>              


   <tr>
          <td height="36" bgcolor="#A4DDED" class="style21"></td>

          <td bgcolor="#A4DDED"><?php 
            //$sql="SELECT * FROM  "" WHERE ""= '$IC2' ";
        //$result = mysql_query($sql);
        //$row = mysql_fetch_array ($result);
            echo $row22['S2']; 
             ?></td>
   </tr>


          <tr>
          <td height="36" bgcolor="#A4DDED" class="style21"></td>

          <td bgcolor="#A4DDED"><?php 
            //$sql="SELECT * FROM  "" WHERE ""= '$IC2' ";
        //$result = mysql_query($sql);
        //$row = mysql_fetch_array ($result);
            echo $row22['S3']; 
             ?></td>
   </tr>


          <tr>
          <td height="36" bgcolor="#A4DDED" class="style21"></td>

          <td bgcolor="#A4DDED"><?php 
            //$sql="SELECT * FROM  "" WHERE ""= '$IC2' ";
        //$result = mysql_query($sql);
        //$row = mysql_fetch_array ($result);
            echo $row22['S4']; 
             ?></td>
   </tr>




 <tr>
          <td height="40" bgcolor="#A4DDED" class="style21">&nbsp;</td>
          <td colspan="4" bgcolor="#A4DDED" class="style24"><?php 
            //$sql="SELECT * FROM  "" WHERE ""= '$IC2' ";
        //$result = mysql_query($sql);
        //$row = mysql_fetch_array ($result);
            echo $row22['S5']; 
             ?></td>
 </tr>

  <tr>
    <td height="36" bgcolor="#A4DDED" class="style21"></td>

     <td bgcolor="#A4DDED" class="style21"><?php 
            //$sql="SELECT * FROM  "" WHERE ""= '$IC2' ";
        //$result = mysql_query($sql);
        //$row = mysql_fetch_array ($result);
            echo $row22['S6']; 
             ?></td>
  </tr>


  <tr>
    <td height="37" bgcolor="#A4DDED" class="style21"></td>

    <td bgcolor="#A4DDED" class="style21"><?php 
            //$sql="SELECT * FROM  "" WHERE ""= '$IC2' ";
        //$result = mysql_query($sql);
        //$row = mysql_fetch_array ($result);
            echo $row22['S7']; 
             ?></td>
  </tr>



  <tr>
    <td height="36" bgcolor="#A4DDED" class="style21"></td>

      <td bgcolor="#A4DDED" class="style21"><?php 
            //$sql="SELECT * FROM  "" WHERE ""= '$IC2' ";
        //$result = mysql_query($sql);
        //$row = mysql_fetch_array ($result);
            echo $row22['D1']; 
             ?></td>
  </tr>

  <tr>
    <td height="37" bgcolor="#A4DDED" class="style21"></td>


    <td bgcolor="#A4DDED" class="style21"><?php 
            //$sql="SELECT * FROM  "" WHERE ""= '$IC2' ";
        //$result = mysql_query($sql);
        //$row = mysql_fetch_array ($result);
            echo $row22['A1']; 
             ?></td>
  </tr>

  <tr>
    <td height="36" bgcolor="#A4DDED" class="style21"></td>

    <td bgcolor="#A4DDED" class="style21"><?php 
            //$sql="SELECT * FROM  "" WHERE ''= '$IC2' ";
        //$result = mysql_query($sql);
        //$row = mysql_fetch_array ($result);
            echo $row22['RE1']; 
             ?></td>
  </tr>
  <tr>
    <td height="37" bgcolor="#A4DDED" class="style21"></td>

    <td bgcolor="#A4DDED" class="style21"><?php 
            //$sql="SELECT * FROM  "" WHERE ""= '$IC2' ";
        //$result = mysql_query($sql);
        //$row = mysql_fetch_array ($result);
            echo $row22['LU2']; 
             ?></td>
  </tr>
  <tr>
    <td height="36" bgcolor="#A4DDED" class="style21"></td>

     <td bgcolor="#A4DDED"><?php 
            //$sql="SELECT * FROM  "" WHERE""= '$IC2' ";
        //$result = mysql_query($sql);
        //$row = mysql_fetch_array ($result);
            echo $row22['NPT']; 
             ?> </td>
   </tr>

  <tr>
    <td height="31" bgcolor="#A4DDED" class="style21"></td>

    <td bgcolor="#A4DDED"><?php 
            //$sql="SELECT * FROM  "" WHERE ""= '$IC2' ";
        //$result = mysql_query($sql);
        //$row = mysql_fetch_array ($result);
            echo $row22['SRP']; 
             ?>
    </td>
   </tr>



  <tr> 
    <td height="35" bgcolor="#A4DDED" class="style21"></td>

    <td bgcolor="#A4DDED" class="style21"><?php 
            //$sql="SELECT * FROM  "" WHERE ""= '$IC2' ";
        //$result = mysql_query($sql);
        //$row = mysql_fetch_array ($result);
            echo $row22['KTDP']; 
             ?></td>
  </tr>


   <tr>
          <td height="34" bgcolor="#A4DDED" class="style21">&nbsp;</td>
          <td colspan="4" bgcolor="#A4DDED" class="style24"><?php 
            //$sql="SELECT * FROM  "" WHERE ""= '$IC2' ";
        //$result = mysql_query($sql);
        //$row = mysql_fetch_array ($result);
            echo $row22['KDP']; 
             ?></td>
   </tr>



    <td height="36" bgcolor="#A4DDED" class="style21"></td>

    <td bgcolor="#A4DDED" class="style21"><?php 
            //$sql="SELECT * FROM "" WHERE ""= '$IC2' ";
        //$result = mysql_query($sql);
        //$row = mysql_fetch_array ($result);
            echo $row22['USPD']; 
             ?></td>
  </tr>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.