开发者

php internal mail system

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";

            开发者_StackOverflow    $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:

<input type="submit" name="delete" value="Delete" />
<input type="submit" name="mark" value="Mark it" />

And in php just check which one is submited

    if(isset($_POST['mark'])){
        //mark stuff
    }else if(isset($_POST['delete'])){
        //delete stuff
    }else{
        //some other stuff
    }


if you have any option to do so whatsoever, see if they are amendable to switching to google apps.

if that's not an option, consider installing squirrelmail

if THAT's not an option, then you may want to look at adding a AJAX-ified button that handles your "marked as read" action and handles that marking in the background. but the best way to go is to use something someone else has already fully developed and is more bullet proof than writing your own email interface from scratch...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜