Jump to content

?? HOW CAN I DO THIS ?? =[


jigsawsoul

Recommended Posts

This code display a list of all my staff members from the database:

<!-- Page Content -->
<?php

$result = 	"SELECT * FROM web_staff
			LEFT JOIN web_login ON web_staff.login_id=web_login.login_id
			WHERE userlevel = '2' ORDER BY firstname ASC";

$result = mysql_query($result) or die( mysql_error() );
while($row = mysql_fetch_assoc($result)) 
{	
		$table .= '
			<tr>
			    <td width="150px">'.$row['firstname'].' '.$row['lastname'].'</td>
			    <td><input type="checkbox" name="selectedstaff[]" value="'.$row['staff_id'].'" unchecked></td>
			</tr>
		';		
 }


?>
<h4>Create Meeting Stage 2 - Meeting Attendance</h4>
<p>Select which staff member's are to attend this meeting.</p>
<form action="test2.php" method="post">
<div class="meeting png_bg">
	<table>
		<?php echo $table; ?>
	</table>
	<br />
	<input class="button" type="submit" value="Submit" />
</div>
</form>

<!-- End Page Content -->

 

But i don't want to display the staff members where there staff_id is equal to, $chairperson or $secretary

 

i can't seem to get this to work can anyone show me help please ?  :shrug:

 

Link to comment
https://forums.phpfreaks.com/topic/189617-how-can-i-do-this/
Share on other sites

FULL PAGE:

<?php

session_start();

include '../../_library/opendb.php';
include '../../_functions/login.php';
include '../../_functions/nav-admin.php';

adminAuthenticate ();

$page = "meeting";

// ****** Add Meeting Add.php Information To Database ******

$title = $_POST['title'];
$tor = $_POST['tor'];
$chairperson = $_POST['chairperson'];
$secretary = $_POST['secretary'];

$query = "INSERT INTO web_occurrences (occurrence_id) VALUES ('')";

if (mysql_query ($query)) {
 $occurrenceid = mysql_insert_id();
 $_SESSION['occurrenceid'] = $occurrenceid;
} 
else {
	$_SESSION['message'] = "
		<div class='notification error png_bg'>
			<a href='#' class='close'><img src='http://stuweb.cms.gre.ac.uk/~hr728/_web/_resources/images/icons/cross_grey_small.png' title='Close this notification' alt='close' /></a>
			<div>
				Error. please can't admin
			</div>
		</div>";
header('Location: list.php');
}

$query = "INSERT INTO web_meeting (occurrence_id, title, reference) VALUES ('$occurrenceid', '$title', '$tor')";

if (mysql_query ($query)) {
 // Added Meeting Information
} 
else {
	$_SESSION['message'] = "
		<div class='notification error png_bg'>
			<a href='#' class='close'><img src='http://stuweb.cms.gre.ac.uk/~hr728/_web/_resources/images/icons/cross_grey_small.png' title='Close this notification' alt='close' /></a>
			<div>
				Error. please can't admin
			</div>
		</div>";
header('Location: list.php');
}

$query = "INSERT INTO web_roles (occurrence_id, staff_id, role) VALUES ('$occurrenceid', '$chairperson', 'Chairperson')";

if (mysql_query ($query)) {
 // Added Chairperson
} 
else {
	$_SESSION['message'] = "
		<div class='notification error png_bg'>
			<a href='#' class='close'><img src='http://stuweb.cms.gre.ac.uk/~hr728/_web/_resources/images/icons/cross_grey_small.png' title='Close this notification' alt='close' /></a>
			<div>
				Error. please can't admin
			</div>
		</div>";
header('Location: list.php');
}

$query = "INSERT INTO web_roles (occurrence_id, staff_id, role) VALUES ('$occurrenceid', '$secretary', 'Secretary')";

if (mysql_query ($query)) {
 // Added Secretary
} 
else {
	$_SESSION['message'] = "
		<div class='notification error png_bg'>
			<a href='#' class='close'><img src='http://stuweb.cms.gre.ac.uk/~hr728/_web/_resources/images/icons/cross_grey_small.png' title='Close this notification' alt='close' /></a>
			<div>
				Error. please can't admin
			</div>
		</div>";
header('Location: list.php');
}

?>

<?php include("../../_template/header-admin.php"); ?>

<body>
<div id="body-wrapper"><div id="sidebar"><div id="sidebar-wrapper">		

<?php include("../../_template/profile-links.php"); ?>

<?php navigation ($page); ?>				
<?php include("../../_template/messages.php"); ?>

</div></div>
<div id="main-content">

<?php include("../../_template/no-js.php"); ?>	
<?php include("../../_template/page-head.php"); ?>

<!-- Page Content -->
<?php

$result = 	"SELECT * FROM web_staff
			LEFT JOIN web_login ON web_staff.login_id=web_login.login_id
			WHERE userlevel = '2' ORDER BY firstname ASC";

$result = mysql_query($result) or die( mysql_error() );
while($row = mysql_fetch_assoc($result)) 
{	
		$table .= '
			<tr>
			    <td width="150px">'.$row['firstname'].' '.$row['lastname'].'</td>
			    <td><input type="checkbox" name="selectedstaff[]" value="'.$row['staff_id'].'" unchecked></td>
			</tr>
		';		
 }


?>
<h4>Create Meeting Stage 2 - Meeting Attendance</h4>
<p>Select which staff member's are to attend this meeting.</p>
<form action="add3.php" method="post">
<div class="meeting png_bg">
	<table>
		<?php echo $table; ?>
	</table>
	<br />
	<input class="button" type="submit" value="Submit" />
</div>
</form>

<!-- End Page Content -->

<?php include("../../_template/footer.php"); ?>

</div></div>
</body>
</html>

<?php unset ($_SESSION['message']); ?>
<?php include '../../_library/closedb.php'; ?>

 

THANK YOU  :o

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/189617-how-can-i-do-this/#findComment-1000782
Share on other sites

so i have a list of all staff member's with a checkbox next to them.

 

$chairperson = $_POST['chairperson'];

$secretary = $_POST['secretary'];

 

is getting the person selected to be the $chairperson from the staff member's and $secretary is doing the same

 

I don't want the chairperson or secretary to be on the page. i want to display all staff members over then the chairperson and secretary

 

$secretary and $chairperson are qual to staff_id's

Link to comment
https://forums.phpfreaks.com/topic/189617-how-can-i-do-this/#findComment-1000783
Share on other sites

So, as I understand what you are trying to do, then your query should read :

 

SELECT * FROM web_staff

            LEFT JOIN web_login ON web_staff.login_id=web_login.login_id

            WHERE userlevel = '2' and staffid <> '$chairperson' and $staffid <> '$secretary' ORDER BY firstname ASC

Link to comment
https://forums.phpfreaks.com/topic/189617-how-can-i-do-this/#findComment-1000790
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.