ok the probelm is the following:
I know how to make the query with the mysql join but my trouble is when I tried to post the variables to get into the sql sentence, it goes from the first page and then the query the idea is to have the first html file linked with the next one and by the end linked with the database and get the query
Example:
this is the code of the screen
<?php
include('mgeneral.html');
$c=mysql_connect("localhost","root","");
if(!$c)
{
die("Not Conected");
}
if(!mysql_select_db("dbspl"))
{
die("Opening Error");
}
echo'<br>';
echo'<br>';
echo'<br>';
echo'<center>';
echo'<font color="#145C87" size="4"><b>User Report</b></font>';
echo'<br>';
echo'<form name="frm" method="post" action="c_users.php">';
echo'<table>';
echo'<tr>';
echo'<td>';
echo'<fieldset>';
echo'<legend align="left"><font color="#145C87"></font></legend>';
echo'<table>';
echo'<tr>';
// macro: makecheckbox
echo'<td align="left"><font color="#145C87"><b>Select All:</b></font></td><td align="right"><input type="checkbox" name="chbtodoa" onClick="ftodoa(document.frm.chbtodoa.value);"></td>';
echo'</tr>';
echo'<tr>';
echo'<td align="left">Name</td><td align="right"><input type="checkbox" name="ckname"></td>';
echo'</tr>';
echo'<tr>';
echo'<td align="left">Surname</td><td align="right"><input type="checkbox" name="cksure"></td>';
echo'</tr>';
echo'<tr>';
echo'<td align="left">Email</td><td align="right"><input type="checkbox" name="ckmail"></td>';
echo'</tr>';
echo'<tr>';
echo'<td align="left">Country</td><td align="right"><input type="checkbox" name="ckcountry"></td>';
echo'</tr>';
echo'<tr>';
echo'<td align="left">District</td><td align="right"><input type="checkbox" name="ckdist"></td>';
echo'</tr>';
echo'</table>';
echo'</fieldset>';
echo'</td>';
echo'<td>';
echo'<fieldset>';
echo'<legend align="left"><font color="#145C87"></font></legend>';
echo'<table>';
echo'<tr>';
echo'<td align="left"><font color="#145C87">Country Code:</font></td><td align="left"><select name="country"><option value=""></option>';
if(!($conxa=mysql_query("SELECT country FROM user")))
{
echo'<center>';
echo'<br>';
echo mysql_error();
echo'<br>';
echo"Query Country Code Error Level 1";
echo'</center>';
}
while($fxa=mysql_fetch_array($conxa))
{
$xecountry =$fxa['country'];
$xelogcountry =trim($xecountry);
echo'<option value="';
echo $xelogcountry;
echo '">';
echo $xelogcountry;
echo'</option>';
}
echo'</select></td>';
echo'</tr>';
echo'<tr>';
echo'<td align="left"><font color="#145C87">District:</font></td><td align="left"><select name="district"><option value=""></option>';
if(!($conzc=mysql_query("SELECT district FROM user GROUP BY district")))
{
echo'<center>';
echo'<br>';
echo mysql_error();
echo'<br>';
echo"Query District Error Level 1";
echo'</center>';
}
while($fzc=mysql_fetch_array($conzc))
{
$xredist =$fzc['district'];
$xlogdist =trim($xredist);
echo'<option value="';
echo $xlogdist;
echo '">';
echo $xlogdist;
echo'</option>';
}
echo'</select></td>';
echo'</tr>';
echo'</table>';
echo'</fieldset>';
echo'</td>';
echo'</tr>';
echo'</table>';
echo'<center>';
echo'<input type="button" value="Submit" onClick="fix();">';
echo'</center>';
echo'</form>';
echo'<center>';
?>
and this is the code to connect to the db and get the query directly in excel
<?php
header("Content-type: aplication/vnd.ms-excel");
header("Content-Disposition: attachment; filename=User Report.xls");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
$c=mysql_connect("localhost","root","");
if(!$c)
{
die("Not Conected");
}
if(!mysql_select_db("dbspl"))
{
die("Opening Error");
}
$varuser="user_id";
if($ckname=="on")
{
$varuser="$varuser".","."name";
}
if($cksure=="on")
{
$varuser="$varuser".","."surename";
}
if($ckmail=="on")
{
$varuser="$varuser".","."email";
}
if($ckcountry=="on")
{
$varuser="$varuser".","."country";
}
if($ckdist=="on")
{
$varuser="$varuser".","."district";
}
////////////////////////////////////////// filters ////////////////////////////////////////////////////////
if($country=="" && $dist=="")
{
$ssw=1;
}
if($country!="" && $dist=="")
{
$ssw=2;
$filter="country="."'$country'";
}
if($country=="" && $dist!="")
{
$ssw=3;
$filter="district="."'$dist'";
}
if ($country!="" && $filter=="")
{
$filter="country="."'$country'";
}
if ($dist!="" && $filter!="" )
{
$filter="$filter"."and district="."'dist'";
}
if ($dist!="" && $filter=="")
{
$filter="district="."'$dist'";
}
if ($dist!="" && $filter!="")
{
$filter="$filter"."and district="."'dist'";
}
////////////////////////////////////////// filters ////////////////////////////////////////////////////////
if($ssw==1)
{
$cstaa="SELECT $varuser FROM user";
}
if($ssw!=1)
{
$cstaa="SELECT $varuser FROM user WHERE $filter";
}
if(!($consula=mysql_query($cstaa)))
{
echo'<center>';
echo'<br>';
echo mysql_error();
echo'<br>';
echo"Query Error Level 2";
echo'</center>';
}
echo'<table border="1">';
echo'<tr>';
if($ckname =="on")
{
echo'<td align="center"><b>Name</b></td>';
}
if($cksure =="on")
{
echo'<td align="center"><b>Surname</b></td>';
}
if($ckmail =="on")
{
echo'<td align="center"><b>Email</b></td>';
}
if($ckcountry =="on")
{
echo'<td align="center"><b>Country ID</b></td>';
}
if($ckdist =="on")
{
echo'<td align="center"><b>District</b></td>';
}
echo'</tr>';
while($filaa=mysql_fetch_array($consula))
{
$xid =$filaa['user_id'] ;
$xtype =$filaa['type'] ;
$xlog =$filaa['login'];
$xpass =$filaa['password'] ;
$xname =$filaa['name'];
$xsure =$filaa['surename'];
$xmail =$filaa['email'];
$xcountry =$filaa['country'];
$xdist =$filaa['district'];
echo'<tr>';
echo'</td>';
if($ckname =="on")
{
echo'<td>';
echo $xname;
echo'</td>';
}
if($cksure =="on")
{
echo'<td>';
echo $xsure;
echo'</td>';
}
if($ckmail =="on")
{
echo'<td>';
echo $xmail;
echo'</td>';
}
if($ckcountry =="on")
{
echo'<td>';
echo $xcountry;
echo'</td>';
}
if($ckdist =="on")
{
echo'<td>';
echo $xdist;
echo'</td>';
}
echo'</tr>';
}
echo'</table>';
?>
The problem is when I tried to link the first one with other screen and then the next one to make a sequence and by the end make a query with all the values.
How can I do that?