I’m looking for some advice if possible. PHP isn’t the main language I write in. It’s normally asp.net with C# but I’m helping out a friend with a website and they have asked for php.
I’m creating an internal mail system for them. I’ve got an inbox page which has a tick box for each record. At the moment you can tick a number of boxes and then delete the selected records by submitting the form. My friend has asked for another button which could be clicked to mark the selected email as read (like am email inbox). I’m not to sure how to do this as I know just adding another submit button to the form as calling it something else won’t work. Apologies, I’m not sure I’m explaining myself well.
Compose
$query ="Select im.ID, first_name, last_name, sender_ID, createddate, recipient_ID, read_mail, subject from internal_mail im join characters c on im.sender_ID = c.ID where im.recipient_name like '%".$character[first_name] . " " . $character[last_name] ."%' and im.active = 1";
$results = mysql_query($query);
$rows_events = mysql_num_rows($results);
if($rows_events != 0){
?>
<table>
<tr>
<td></td>
<td width="200">
From
</td>
<td width="150">
Subject
</td>
<td>
Date Sent
</td>
</tr>
<tr>
<?
$r = 0;
while ($r < $rows_events){
$read = mysql_result($results, $r , "read_mail");
$ID = mysql_result($results, $r , "ID");
$first_name = mysql_result($results, $r , "first_name");
$last_name = $sender_ID = mysql_result($results, $r , "last_name");
$subject = mysql_result($results, $r , "subject");
$createddate = mysql_result($results, $r , "createddate");;
echo "<tr>";
echo "<td><input type='checkbox' name='" . $ID . "'/></td>";
echo "<td>";
echo $first_name . " " . $last_name;
echo "</td>\n";
echo "<td>";
if($read == 0){
echo"<b><a href=read.php?message_ID=" . $ID . ">" .$subject . "</b></a>";
}else{
echo"<a href=read.php?message_ID=" . $ID . ">" .$subject . "</a>";
}
echo "</td>\n";
echo "<td>".$createddate ."</td>\n";
echo "</tr>\n";
$r ++;
}
?>
</tr>
</table>
<input type="submit" name="delete" value="Delete" />
</form>
<?
}else{
echo "You currently have no mail in your inbox :(";
}
If anyone could point me in the direction of a tutorial for this type of thing I would be grateful, I’ve had a little look around google and haven’t found much.
You can add another submit:
And in php just check which one is submited