Jump to content

[SOLVED] help with email forward feature...


rsammy

Recommended Posts

i am working on an email module in a patient application. i have some info on the email body (which is displayed as a message blob) apart from 'To' 'From' and 'Subject'. I also have reply and forward buttons.

i need to send the logic to the same page, compose.php when either reply or forward is clicked. haviing said that, i need to display the original message (distinguish it with some mark or something -just as in outlook or hotmail) which cannot be edited while leaving some space for the new message!

how is this possible?

this is my code...

[code]      <form name="viewMessages" method="post" action="view.php">

        <p><br>&nbsp;</p>
        <table width="681" border="0" cellspacing="0" cellpadding="0">

  <tr>

            <td width="16"><img src="images/clear.gif" width="10" height="15"></td>

<td width="601" bgcolor="#0099CC">
  <div align="right">
                <input type="hidden" name="mess_id" value="<?PHP print($rowdisplay["ID"]); ?>">
                <input type="hidden" name="m1" value="<?PHP print("$m1"); ?>">
                <input type="hidden" name="d1" value="<?PHP print("$d1"); ?>">
                <input type="hidden" name="y1" value="<?PHP print("$y1"); ?>">
                <input type="hidden" name="m2" value="<?PHP print("$m2"); ?>">
                <input type="hidden" name="d2" value="<?PHP print("$d2"); ?>">
                <input type="hidden" name="y2" value="<?PHP print("$y2"); ?>">
                <input type="hidden" name="messagevariable" value="<?PHP print("$messagevariable"); ?>">

            <input class="sbttnW" type="submit" name="forward" value="Forward">
            <input class="sbttnW" type="submit" name="reply" value="Reply">
              </div>

</td>

<td width="64"><img src="images/clear.gif" width="25" height="15"></td>

  </tr>

            <td width="16">&nbsp;</td>

<td>

  <table width="601" border="1" cellspacing="0" cellpadding="0" bordercolor="#0099CC">
                <tr>

  <td width="597">

                    <table width="597" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="15">&nbsp;</td>
                        <td width="85">&nbsp;</td>
                        <td width="270">&nbsp;</td>
                        <td width="212">&nbsp;</td>
                        <td width="37"><img src="images/clear.gif" width="10" height="15"></td>
                      </tr>
                      <tr>
                        <td width="15">&nbsp;</td>
                        <td width="85"> <div align="left"><b>From:</b></div></td>

                        <!--<td colspan="2"> <?PHP print($rowdisplay["from_p"]); ?> </td>-->
                        <td colspan="2"> <?PHP

$queryfrom = "SELECT user_fname, user_lname, user_email FROM user_mgr WHERE user_email='$from_p' ";
//echo "$query";
$resultfrom = mysql_query($queryfrom);

$rowfrom = mysql_fetch_array($resultfrom);

//print($queryfrom);
$fname= $rowfrom["user_fname"];
$lname=$rowfrom["user_lname"];
//$uname = $user_fname ." ". $user_lname;
$uname = $fname ." ". $lname;

print ($uname);

?> </td>

                        <td width="37">&nbsp;</td>
                      </tr>
                      <tr>
                        <td>&nbsp;</td>
                        <td><b>To:</b></td>

                        <!--<td colspan="2"><? print($rowdisplay["to_email"]); ?></td>-->
                        <td colspan="2"> <?PHP

$queryto = "SELECT user_fname, user_lname, user_email FROM user_mgr WHERE user_email='$to_email'";
$resultto = mysql_query($queryto);

$rowto = mysql_fetch_array($resultto);

$tofname= $rowto["user_fname"];
$tolname=$rowto["user_lname"];
$toname = $tofname ." ". $tolname;

print ($toname);
?> </td>

                        <td>&nbsp;</td>
                      </tr>
                      <tr>
                        <td width="15">&nbsp;</td>
                        <td width="85"> <div align="left"><b>Received:</b></div></td>
                        <!--<td colspan="2"> <?PHP print($rowdisplay["date"]); ?> </td>-->
                        <td colspan="2"> <?PHP print($rowdisplay["date"]."&nbsp;&nbsp;".$rowdisplay["time_sent"] . " ET"); ?> </td>
                        <td width="37">&nbsp;</td>
                      </tr>
                      <tr>
                        <td width="15">&nbsp;</td>
                        <td width="85"> <div align="left"><b>Subject:</b></div></td>
                        <td colspan="2"> <?PHP print($rowdisplay["subject"]); ?> </td>
                        <td width="37">&nbsp;</td>
                      </tr>
                      <tr>
                        <td width="15">&nbsp;</td>
                        <td width="85"> <div align="left"><b></b></div></td>
                        <td width="270">&nbsp;</td>
                        <td width="212">&nbsp;</td>
                        <td width="37">&nbsp;</td>
                      </tr>
                      <tr>
                        <td width="15">&nbsp;</td>
                        <td width="85"> <div align="left"><b>Message:</b></div></td>
                        <td colspan="2" rowspan="4" align="left" valign="top">
                          <?PHP print($rowdisplay["message"]); ?> </td>
                        <td width="37">&nbsp;</td>
                      </tr>
                      <tr>
                        <td width="15">&nbsp;</td>
                        <td width="85">&nbsp;</td>
                        <td width="37">&nbsp;</td>
                      </tr>
                      <tr>
                        <td width="15">&nbsp;</td>
                        <td width="85">&nbsp;</td>
                        <td width="37">&nbsp;</td>
                      </tr>
                      <tr>
                        <td width="15">&nbsp;</td>
                        <td width="85">&nbsp;</td>
                        <td width="37">&nbsp;</td>
                      </tr>
                    </table>

  </td>

</tr>

  </table>

</td>

<td width="64"><img src="images/clear.gif" width="10" height="15"></td>

  </tr>

</table>

  </form>

</td>

  </tr>

  <tr>

    <td colspan="2"><div align="center">
    <?

if ($visit_type == ICN)
{
if ($dcn_posted_for_billing =="No")
{
if ($dcn_approved_for_billing =="No")
{

$requestforApproval='Yes';
print(" <br>
<input class='sbttn' type='submit' name='action' value='Approve for Billing' onClick=\"location.href='main.php?mess_id=$mess_id&m1=$m1&d1=$d1&y1=$y1&m2=$m2&d2=$d2&y2=$y2&requestforApproval=$requestforApproval&mesgtran_ID=$mesgtran_ID'\">

");


}

}

}


    ?>
    </div></td>
  </tr>
  <tr>
    <td colspan="3" height="2"><div align="center"><br><br>
  <!--<input class="sbttn" type="submit" name="print" value="Print Friendly">-->
<?

print(" <br>
<input class='sbttn' type='submit' name='action' value='Print Friendly' onClick=\"location.href='printMCtemplate.php?mess_id=$mess_id&m1=$m1&d1=$d1&y1=$y1&m2=$m2&d2=$d2&y2=$y2'\">

");

?>

    </div></td>
    <td width="67">&nbsp;</td>
  </tr>
</table>[/code]

Link to comment
https://forums.phpfreaks.com/topic/35171-solved-help-with-email-forward-feature/
Share on other sites

forgot to show this:

here is how the email body is:

From: Barbara Ueckert   
  To: Office Manager   
  Received: 01/16/2007  3:58 PM ET   
  Subject: Jack Jones - ICN   
       
  Message: PATIENT NAME: Jack Jones
VISIT DATE: 1/16/07
PATIENT #: 123456789
DOB: 03/18/1945
SEX: Male
PREF PROVIDER: Barbara Ueckert
REF #:
STATUS: Follow
VISIT TIME: 12:55 PM
ATTENDING PROVIDER: Barbara Ueckert
LOCATION: City Gen. Emgcy Facility
DIAGNOSIS: 10-19% Bdy Brn/10-19% 3d - 948.11
PROCEDURE: 1 stage mohs, up to 5 spec - 17304;Ablate heart dysrhythm focus - 93651
TRANSACTION ID: 5967886
this is my email screen on view.php:

From: Barbara Ueckert   
  To: Office Manager   
  Received: 01/16/2007  3:58 PM ET   
  Subject: Jack Jones - ICN   
       
  Message: PATIENT NAME: Jack Jones
VISIT DATE: 1/16/07
PATIENT #: 123456789
DOB: 03/18/1945
SEX: Male
PREF PROVIDER: Barbara Ueckert
REF #:
STATUS: Follow
VISIT TIME: 12:55 PM
ATTENDING PROVIDER: Barbara Ueckert
LOCATION: City Gen. Emgcy Facility
DIAGNOSIS: 10-19% Bdy Brn/10-19% 3d - 948.11
PROCEDURE: 1 stage mohs, up to 5 spec - 17304;Ablate heart dysrhythm focus - 93651
TRANSACTION ID: 5967886

now, i have a forward button on the screen too, along with a reply button! when i hit them, i shud go to the next screen(compose.php) and i shud be abel to choose the recipient of this forwarded email. at the same time, i will still need to retain the original email and them be able to add some more text to it.

the way this page works now is, i am not carrying over the message text(email body) to the next page(compose.php). the message is stored in the database in a blob! how do i carry the message over to the next page and then enable additional lines of text being added to the text on the next page?

currently, i am able to display the recipient(drop down field with actual recipient selected by default), senders name, date and time messge was received and Subject. but, the message blob is not displayed. i need t odisplay this blob as well as be able to alter/add more lines of text to it.
tried it. it doesnt work! here is wat im doing...

i am executing this query to get the messagevariable:

*************

$querydisplay = "SELECT messages.message, messages.user_id, messages.status, messages.from_p, messages.subject, DATE_FORMAT(messages.received, '%m/%d/%Y') as date, messages.ID, messages.to_email, messages.time_sent, messages.grp_id, messages.tran_ID
FROM messages
WHERE messages.ID='$mess_id'
AND messages.request !='settodelete'";

$resultdisplay = mysql_query($querydisplay);
$num_rows = mysql_num_rows($resultdisplay);
$rowdisplay = mysql_fetch_array($resultdisplay);
$from_p = $rowdisplay["from_p"];
$to_email = $rowdisplay["to_email"];
$mesgtran_ID = $rowdisplay["tran_ID"];
$messagevariable = $rowdisplay["message"];

***************



[code]  
<tr>

  <td width="16"><img src="images/clear.gif" width="10" height="15"></td>
      <td width="601" bgcolor="#0099CC">
<div align="right">
                <input type="hidden" name="mess_id" value="<?PHP print($rowdisplay["ID"]); ?>">
                <input type="hidden" name="m1" value="<?PHP print("$m1"); ?>">
                <input type="hidden" name="d1" value="<?PHP print("$d1"); ?>">
                <input type="hidden" name="y1" value="<?PHP print("$y1"); ?>">
                <input type="hidden" name="m2" value="<?PHP print("$m2"); ?>">
                <input type="hidden" name="d2" value="<?PHP print("$d2"); ?>">
                <input type="hidden" name="y2" value="<?PHP print("$y2"); ?>">
                <input type="hidden" name="messagevariable" value="<?PHP print("$messagevariable"); ?>">
                <?

                $_SESSION['messagevariable']=$messagevariable;

                ?>

            <input class="sbttnW" type="submit" name="forward" value="Forward">
            <input class="sbttnW" type="submit" name="reply" value="Reply">
              </div>

</td>

<td width="64"><img src="images/clear.gif" width="25" height="15"></td>

</tr>[/code]

i am using the following code to send it to compose.php from current page(view.php):

[code]

if (isset($_POST["reply"]))
{
      header("Location: compose.php?mess_id=".$_POST["mess_id"]. "&reply=".$_POST["reply"]. "&m1=".$_POST["m1"]."&d1=".$_POST["d1"]."&y1=".$_POST["y1"]."&m2=".$_POST["m2"]."&d2=".$_POST["d2"]."&y2=".$_POST["y2"]."&inboxcounter=".$_POST["inboxcounter"]."&sentcounter=".$_POST["sentcounter"]);

      exit;

}

//forward the message
if (isset($_POST["forward"]))
{
      header("Location: compose.php?mess_id=".$_POST["mess_id"]. "&reply=".$_POST["reply"]. "&m1=".$_POST["m1"]."&d1=".$_POST["d1"]."&y1=".$_POST["y1"]."&m2=".$_POST["m2"]."&d2=".$_POST["d2"]."&y2=".$_POST["y2"]."&inboxcounter=".$_POST["inboxcounter"]."&sentcounter=".$_POST["sentcounter"]);

      exit;

}[/code]

and on the next page(compose.php) this is wat im doing:

$messagevariable=$_POST["messagevariable"];

to retrieve the variable and trying to display it here!

  • 1 month later...

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.