Hi hope some one can help.
I get all my mebers off my database and display using this
<?PHP
include("dbinfo.inc.php");
$conn = mysql_connect($host, $username, $password) or die(mysql_error());
mysql_select_db($database,$conn) or die(mysql_error());
$query = "SELECT * from landlordlo" or die (mysql_error());
$result = mysql_query($query) or die ("Could not run query.");
$num_rows = mysql_num_rows($result);
echo "<font face='Verdana' size='2' color='#FF0000'><font size='1' face='Verdana'>( $num_rows )</a></td> Members Found on Database</font>";
}
?>
<table width="600" border="0" cellspacing="0" cellpadding="0" align="centre" >
<tr>
<td width="100" align="center"><font face="Verdana" size="2" color="#000000">Check Box:</font></td>
<td width="200" align="center"><font face="Verdana" size="2" color="#000000">Username:</font></td>
<td width="300" align="center"><font face="Verdana" size="2" color="#000000">Email</font></td>
</tr>
</tr>
</table>
<table border="0" width="600" height="30" bordercolor="#111111">
<tr>
<td style="border-style:solid; border-width:1px; border-color:#000000;" width="600" height="100" valign="top" bgcolor="#FFFFFF" bordercolor="#111111">
<div class="scrollable" style="height:400px; width:600; overflow:auto;">
<table cellSpacing="0" cellPadding="1" border="0" id="RecentFeedback" class="itemTable" width="600" height="20" align="top">
<td align="center"><font face="Verdana" size="2" color="#000000"></td>
<td align="center"><font face="Verdana" size="2" color="#000000"></td>
<td align="center"><font face="Verdana" size="2" color="#000000"></td>
</tr>
<?
$color1 = '#EEEEEE';
$color2 = '#FFFFFFF';
$i = 0;
while ($row = mysql_fetch_array($result)) {
$color = (($i%2 == 0 || $i == 0) ? $color1 : $color2);
$user=$row['username'];
$email=$row['email'];
?>
<form action="adminemail.php" method="post">
<font face="Verdana" size="2" color="#000000">
<th><input type="checkbox" name="email" value="<? echo $email; ?>l" MULTIPLE> <? echo "<td bgcolor=$color align='center' size='100'><font face='Verdana' size='2' color='#000000'>$email</td>"; ?></th>
<th><input type="hidden" value="<? echo $user; ?>" name="username"><? echo "<td bgcolor=$color align='center' size='200'><font face='Verdana' size='2' color='#000000'>$user</td>"; ?></th>
</font>
</tr>
<?
$i++;
}
echo "</table>";
?>
<input type="checkbox" name="checkall" onclick="checkUncheckAll(this);"/>select/unselect<br /><input type="submit" value ="send"></form>
</body>
</html>
This then diplays all the records held. I want to use the checkbox to select/unselect as required. This is the sent to
adminemail.php
<?PHP session_start();
$hostname = $_SERVER['REMOTE_ADDR'];
echo $hostname;
if ($hostname='???????????') {
$message=$_POST['message'];
if($_POST['submit']=="send") {
$errcount = 0;
$error1="<span style='color:red'>";
//check if someone has filled out a form
//validate name
if(preg_match('/^[a-zA-Z0-9_-]{1,}$/i', $_POST['message'])){
$message = $_POST['message'];
}
else {
$error1 .= "Required!";
$errcount++;
}
if ($errcount !=0) {
//displays errors in form boxes
}
else {
$message=$_POST['message'];
$headers = "From: admin email\r\n";
$headers = "Reply-to: admin email\r\n";
$headers = "BCC: admin email\r\n";
$headers .= 'Content-Type: text/html';
$subject = "Welcome";
$rc = mail($email, $subject, nl2br($message),$headers);
}
if ($rc) {
die(print "<font face ='verdana' size='2'>Mail successfully sent!");
}
else {
die(print "<font face ='verdana' size='2'>Failed to send mail");
}
}
}
?>
<tr>
<th width="180" valign="top" bgcolor="#CCCCCC" class="sideBody" scope="col"><p align="left"><span class="sideHeads">ADMIN AREA</span><br>
</th>
<th colspan="2" valign="top" bgcolor="#FFFFFF" class="bodycopy" scope="col" align="left">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table width="100%" border="0" cellpadding="2" cellspacing="2" bgcolor="#FFFFFF">
<tr>
<th width="100%" valign="top" scope="col"><div align="left" class="bodycopy">
Enter your message below <? echo $error1; ?><br><textarea name="message" value="<? echo $message; ?>" cols="80" rows="20"><? echo $message; ?></textarea><br><input name="submit" type="submit" value="send" /><input type='button' value='Retry' onClick='history.go(-1)'><br>
</span>
</div></th>
</tr>
</table>
</form>
How can I tranfer all selected records to adminemail.php using the checkbox, I have been trying for two days using sessions etc but with no joy. I am sure it will be quite simple but some things dont come so easily to us all,
thanks roscor