Viewing multiple checkbox in multiple columns in the database using PHP

  • Profile Image
    smit
    Asked on November 07, 2015 at 08:51 AM

    how to view multiple checkbox values in multiple column in database using php

    this is my code

    <?php

    include('config.php');

     

    //echo '<pre>';print_r($_POST);

     

    //echo sizeof($_POST['size_name']);

     

    if(isset($_POST['submit']))

    $data[]=array("id"=>0,"application_name"=>"","range_name"=>"","size_name"=>"","image"=>"");

     

    if(isset($_POST['size_name']))

    {   

    $val=$_POST['size_name'];

    for($i="0";$i<sizeof($val);$i++)

    {

    $seldata=mysql_query("select * from tiles where size_name='".$val[$i]."'")or die(mysql_error());

    while($data1=mysql_fetch_assoc($seldata))

    {

    $data[]=$data1;

    }

    }

    }

     

    if(isset($_POST['application_name']))

    {   

    $val=$_POST['application_name'];

    for($i="0";$i<sizeof($val);$i++)

    {

    $seldata=mysql_query("select * from tiles where application_name='".$val[$i]."'")or die(mysql_error());

    while($data2=mysql_fetch_assoc($seldata))

    $nm=$i+1;

    if(($data2['id']!=$data[$nm]['id']) && ($data[$nm]!="0"))

    {

    $data[]=$data2; 

    }

    }

    }

     

    }

    if(isset($_POST['range_name']))

    {   

    $val=$_POST['range_name'];

    for($i="0";$i<sizeof($val);$i++)

    {

    $seldata=mysql_query("select * from tiles where range_name='".$val[$i]."'")or die(mysql_error());

    while($data3=mysql_fetch_assoc($seldata))

    {

    $nm=$i+1;

    if(($data3['id']!=$data[$nm]['id'])  && ($data[$nm]!="0"))

    {

    $data[]=$data3; 

    }

     

    }

     

    }

    }

     

     

    unset($data["0"]);

    echo '<pre>';print_r($data);

  • Profile Image
    Jan
    Answered on November 07, 2015 at 09:04 AM

    You might need to hire a developer in order to configure or modify your SQL database in order to display multiple check boxes. 

    Please check our API page to know more connecting your form to a database. You can also check our Webhooks about connecting apps or sending data.

    Hope that helps. Thank you.