Forum Moderators: coopster
<?php
require('function_db_connection.php');
$query = "SELECT * FROM departments ORDER BY department";
$result = mysql_query($query);
$tdcount = 1;
$numtd = 4; // number of cells per row
echo "<table>";
while($row = mysql_fetch_array($result)) {
if ($tdcount == 1)
//something wrong here--
echo "<td><input type=\"checkbox\" name=\"department\" value=\"";
echo $row['department_id'];
echo "\" />";
echo $row['department'];
echo "</td>";
//--to here
if ($tdcount == $numtd) {
echo "</tr>";
$tdcount = 1;
} else {
$tdcount++;
}
}
// close the table
if ($tdcount!= 1) {
while ($tdcount <= $numtd) {
echo "<td> </td>";
$tdcount++;
}
echo "</tr>";
}
echo "</table>";
echo "</body>";
echo "</html>";
require ('footer.php');
?>
<table><td><input type="checkbox" name="department" value="2" />Administration</td>3" />ER</td>4" />OR</td><td> </td></tr></table></body></html>
while($row = mysql_fetch_array($result)) {
if ($tdcount <= $numtd) { // As mentioned ,less than or equal to . . .
echo "<td><input type=\"checkbox\" name=\"department\" value=\"" .
$row['department_id'] . "\" />" . $row['department'] . "</td>";
}
if ($tdcount == $numtd) {
echo "</tr>";
$tdcount = 1;
} else { $tdcount++; }
}
<center>
<form action="printer_info.php" method=get>
<table border="2">
<b>Departments</b>
<tr>
<?php
require('function_db_connection.php');
$query = "SELECT * FROM departments ORDER BY department";
$result = mysql_query($query);
$tdcount = 1;
// number of cells per row
$numtd = 1;
/*Grabs the Departments*/
while($row = mysql_fetch_array($result)) {
if ($tdcount <= $numtd) {
echo "<td><input type=\"checkbox\" name=\"department[" . $row['department_id'] . "]\" id = \"dept_";
echo $row['department_id'];
echo "\" value = \"1\">";
echo $row['department'];
echo "</td>";
}
if ($tdcount == $numtd) {
echo "</tr>";
$tdcount = 1;
} else {
$tdcount++;}
}
// close table
if ($tdcount!= 1) {
while ($tdcount <= $numtd) {
echo "<td> </td>";
$tdcount++;
}
echo "</tr>";
}
?>
</td>
<?php
require('header.php');
/* $query = "select * from department";
$result = mysql_query($query);
while($row = mysql_fetch_array($result))
{
$dept_ */
//$deptid = $_GET['department'];
//$deptid = $HTTP_POST_VARS['department'];
/*$dept_id = $_POST['department'];
if(empty($dept_id)) {
$dept_id = "%";
} else {
$N = count($dept_id);
echo("You selected $N department(s): ");
for ($i=0; $i < $N; $i++)
{
echo ($dept_id[$i] . " ");
}
} */
//$deptid = implode(",",$_POST['department']);
foreach ($_POST['department'] as $key => $value) {
echo "Key: $key; Value: $value<br>";
}
$dstart = $_GET['start'];
$dend = $_GET['end'];
echo $deptid;
echo $dstart;
echo $dend;
echo "hello!";
/*starting new table to store that DATA*/ http://******/printer_reports/printer_info.php?department[2]=1&department[3]=1&department[4]=1&start=&end=
$deptid = array();
$deptid = $_GET['department'];
$N = count(array_keys($deptid));
if ($N > 0) {
echo "<p>You selected $N department(s): </p><ul>";
foreach ($deptid as $key => $value) {
// So now you can operate on $value for $departments[array index][deparment id]
echo "<li>Key: $key; Value: $value</li>";
}
echo '</ul>';
}
else { echo "<p>No departments selected.</p>"; }
<html>
<body>
<?php
require ('header.php');
?>
<form method="POST" action="processlogin.php">
Username: <input type="text" name="username" size="15" /><br />
Password: <input type="password" name="password" size="15" /><br />
<div align="center">
<p><input type="submit" value="Login" /></p>
</div>
</form>
<?php
require ('footer.php');
?>
</body>
</html>
<?php
require ('header.php');
// using ldap bind
$ldaprdn = $_POST['username']; // ldap rdn or dn
$ldappass = $_POST['password']; // associated password
// connect to ldap server
$ldapconn = ldap_connect(" :) ")
or die("Could not connect to LDAP server.");
if ($ldapconn) {
// binding to ldap server
$ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
// verify binding
if ($ldapbind) {
echo "LDAP bind successful :) ";
} else {
echo "LDAP bind failed...";
}
}
require ('footer.php');
?>
header.php file. You should change the order such that you read your data from the database (or at the very least determine that there is data for this request) and store it somewhere before you start sending any HTML to the browser. This then allows you to send the correct HTTP header 404 status code if there is no database entry for the current request. It is too late to start sending HTTP headers once you've started to send the HTML part of the page. footer.php file after the closing </html> tag. That included file should usually be located just before the closing </body> tag.
<?php
require ('header.php');
// using ldap bind
$ldaprdn = $_POST['username']; // ldap rdn or dn
$ldappass = $_POST['password']; // associated password
$ldapdomain = "domain.company.net"; // Ldap domian authentication
$ldaprdn2 = $ldaprdn . "@" . $ldapdomain;
echo $ldaprdn2;
// connect to ldap server
$ldapconn = ldap_connect(" :) ")
or die("Could not connect to LDAP server.");
if ($ldapconn) {
// binding to ldap server
$ldapbind = ldap_bind($ldapconn, $ldaprdn2, $ldappass);
// verify binding
if ($ldapbind) {
echo "<center><b>LDAP bind successful...</b>";
echo "<META http-equiv=\"refresh\" content=\"3 URL=http://addprinter.php\">";
echo "<center><b>Please do not refresh this page.</b>";
echo "<center><b>You will be redirected automatically.</b>";
} else {
echo "<center><b>LDAP bind failed...</b>";
}
}
require ('footer.php');
?>