<?php

// Database Connection
require_once("condition.php");
$host="localhost";
$uname="root";
$pass="";
$database = "data"; 

$connection=mysql_connect($host,$uname,$pass); 

echo mysql_error();

//or die("Database Connection Failed");
$selectdb=mysql_select_db($database) or 
die("Database could not be selected"); 
$result=mysql_select_db($database)
or die("database cannot be selected <br>");
$projno=$_POST['parameters'];
function IsChecked($chkname,$value)
    {
        if(!empty($_POST[$chkname]))
        {
            foreach($_POST[$chkname] as $chkval)
            {
                if($chkval == $value)
                {
                    return true;
                }
            }
        }
        return false;
    }


if (isset($_POST['parameters']) && (isset($_POST['chkbox1'])) && (isset($_POST['fileformat'])))  {
 $query = "SELECT DISTINCT INODC_PR_N FROM chemical";
 $result = mysql_query ($query);
while( $r = mysql_fetch_array($result)){
 if( ($_POST['parameters'] == $r['INODC_PR_N'])){
$checked = $_POST['chkbox1'];
foreach ($checked as $chk) {
    switch ($chk) {
        case 'chemical' :

            // do something here
            chemical();
            break;
        case 'physical' :
            // do something here
            physical();
            break;
        case 'pollution1' :
            // do something here
            pollution1();
            break;
              case 'pollution2' :
            // do something here
            pollution2();
            break;
        default :
            echo "ERROR";
            break;
    }
}


}
}
}



?>




<?php

// Database Connection
require_once("condition.php");
$host="localhost";
$uname="root";
$pass="";
$database = "data"; 

$connection=mysql_connect($host,$uname,$pass); 

echo mysql_error();

//or die("Database Connection Failed");
$selectdb=mysql_select_db($database) or 
die("Database could not be selected"); 
$result=mysql_select_db($database)
or die("database cannot be selected <br>");
$projno=$_POST['parameters'];
function IsChecked($chkname,$value)
    {
        if(!empty($_POST[$chkname]))
        {
            foreach($_POST[$chkname] as $chkval)
            {
                if($chkval == $value)
                {
                    return true;
                }
            }
        }
        return false;
    }


if (isset($_POST['parameters']) && (isset($_POST['chkbox1'])) && (isset($_POST['fileformat'])))  {
 $query = "SELECT DISTINCT INODC_PR_N FROM chemical";
 $result = mysql_query ($query);
while( $r = mysql_fetch_array($result)){
 if( ($_POST['parameters'] == $r['INODC_PR_N'])){
$checked = $_POST['chkbox1'];
foreach ($checked as $chk) {
    switch ($chk) {
        case 'chemical' :

            // do something here
            chemical();
            break;
        case 'physical' :
            // do something here
            physical();
            break;
        case 'pollution1' :
            // do something here
            pollution1();
            break;
              case 'pollution2' :
            // do something here
            pollution2();
            break;
        default :
            echo "ERROR";
            break;
    }
}


}
}
}



?>

Recommended Answers

All 3 Replies

Member Avatar for diafol

So? What's the question?

when 4 check box are checked 4 files should be downloaded simultaneously

the abv code only 1 file gets downloaded

Be a part of the DaniWeb community

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