Jump to content

sevendeserts

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

sevendeserts's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have php script that i want it to store multiple checkboxes value in MySQL. please see this: [img src=\"http://www.arab-x.com/uploads/Mar-06/3d6c84aba6.jpg\" border=\"0\" alt=\"IPB Image\" /] and this my script, it shows the rows but doesnt save the values [code] <?php       defined( '_VALID_LM' ) or die( 'Direct Access to this location is not allowed.' );       global $conn;       if(isset($save)){       echo "Hi !";       $p_searchx =$_POST['search'];       foreach ($p_searchx as $p_search)            $query = "insert into lm_users(p_search)values('$p_search[search]') WHERE username = 'username[]'";         $result = mysql_query($query) or die ("query not made");       } ?> <table width="100%" border="0" cellspacing="2" cellpadding="2">   <tr>     <td>    <table width="100%" border="0" cellspacing="2" cellpadding="2">    <tr>     <td width="30%">Enter the user name:</td>     <td width="40%"><input name="textfield" type="text" size="25" maxlength="25"></td>     <td width="30%"><input type="submit" name="Submit" value="Search"></td>   </tr> </table>    </td>   </tr>   <tr>     <td>Editing options </td>   </tr>   <tr>     <td>    <form method="POST" action="index.php?option=fishylist&action=ucp">    <table width="100%" border="1" cellspacing="0" cellpadding="2">   <tr>     <td width="3%">Del</td>     <td colspan="2">Details</td>     <td colspan="4">Privillages</td>   </tr>   <tr>     <td> </td>     <td width="30%">name</td>     <td width="30%">branch</td>     <td width="10%">Search</td>     <td width="10%">Add</td>     <td width="10%">Edit</td>     <td width="10%">Delete</td>   </tr>      <?php                     $rs=$conn->Execute("SELECT * FROM lm_users");              if(($row_total=$rs->RecordCount()>0) && $rsa=$rs->GetArray() ) {       $row_total=$conn->RecordCount();       foreach($rsa as $row) {            ?>   <tr>     <td><input type="checkbox" name="checkbox[]" id="checkbox[]" value="<? //echo $rows['id']; ?>"></td>     <td><?php echo $row['username']; ?></td>     <td><?php echo $row['userbranch'];?></td>     <td><input type="checkbox" name= "search[]" value="1" <?php if ($row['p_search'] == 1) {echo "checked";} ?>></td>     <td><input type="checkbox" name= "search[]" value="1" <?php if ($row['p_add'] == 1) {echo "checked";} ?>></td>     <td><input type="checkbox" name= "search[]" value="1" <?php if ($row['p_edit'] == 1) {echo "checked";} ?>></td>     <td><input type="checkbox" name= "search[]" value="1" <?php if ($row['p_delete'] == 1) {echo "checked";} ?>></td>   </tr>      <?php } }?>   <tr>     <td> </td>     <td>Pagination</td>     <td> </td>     <td> </td>     <td> </td>     <td> </td>     <td> </td>   </tr>   <tr>     <td> </td>     <td> </td>     <td><input type="submit" name="save" value="Save"></td>     <td> </td>     <td> </td>     <td> </td>     <td> </td>   </tr> </table>    </form>    </td>   </tr> </table> [/code]
×
×
  • 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.