Jump to content

[SOLVED] header problem in email!


rsammy

Recommended Posts

i am trying to create a button in the email body. when this button is clicked, a flag in the datbase is updated to Yes and the page remains where it is with the button gone!

the button i created is, 'Approve for Billing'. Here is my code to execute this. whats wrong here?

[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="inboxcounter" value="<?PHP print("$inboxcounter"); ?>">
                <input type="hidden" name="sentcounter" value="<?PHP print("$sentcounter"); ?>">
                <input type="hidden" name="messagevariable" value="<?PHP print("$messagevariable"); ?>">
                <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
                       

$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"> <?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"]."&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>
                      <tr>
                        <td width="15">&nbsp;</td>
                        <td width="85">&nbsp;</td>
                        <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("
<input class='sbttn' type='submit' name='action' value='Approve for Billing' onClick=\"location.href='view.php?approval=$requestforApproval&mess_id=$mess_id&m1=$m1&d1=$d1&y1=$y1&m2=$m2&d2=$d2&y2=$y2&tran_id=$mesgtran_ID'\">

    ");

}

}
else
{
$requestforApproval='No';
}

}


?>-->
                        <?
if ($dcn_posted_for_billing =="No")
{
if ($dcn_approved_for_billing =="No")
{
$requestforApproval='Yes';

?>
<input class="sbttn" type="submit" name="billing" value="Approve for Billing">
<?

}

}
else
{
$requestforApproval='No';
}

/*
$querydcn = "UPDATE dcn SET dcn_approved_for_billing='$requestforApproval' WHERE dcn_tran_ID='$mesgtran_ID' ";
mysql_query($querydcn);
*/

?>

                          </div></td>
                        <td colspan="2"><div align="center">
                            <input class="sbttn" type="submit" name="print" value="Print Friendly">
                          </div></td>
<td width="67">&nbsp;</td>
                        <td colspan="2"><div align="center">
                            <input class="sbttn" type="submit" name="forward" value="Forward Message">
                          </div></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>[/code]

and here is the code i am using(existing code) to do a GET/POST etc., and update the table!  i am kinda confused with the Header stuff... thats where i get an error!  can someone help?


[code] $mess_id=$_GET["mess_id"];
$m1=$_GET["m1"];
$d1=$_GET["d1"];
$y1=$_GET["y1"];
$m2=$_GET["m2"];
$d2=$_GET["d2"];
$y2=$_GET["y2"];
$inboxcounter=$_GET["incount"];
$sentcounter=$_GET["sentcount"];

$dbdates="$y2-$m2-$d2";
$dbdate ="$y1-$m1-$d1";


//Reply to the message

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"]);
//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"]."&messagevariable=".$_POST["messagevariable"]);

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"]);
//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"]."&messagevariable=".$_POST["messagevariable"]);

exit;

}

//approve for billig
if (isset($_POST["billing"]))

{

$requestforApproval = $_GET["approval"];
$dcn_tran_id = $_GET["tran_id"];

$querydcn = "UPDATE dcn SET dcn_approved_for_billing='$requestforApproval' WHERE dcn_tran_ID='$dcn_tran_id' ";
mysql_query($querydcn);


//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"]);
//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"]."&messagevariable=".$_POST["messagevariable"]);
header("Location: view.php?mess_id=".$_POST["mess_id"]. "&reply=".$_POST["reply"]. "&approval=".$_POST["requestforApproval"]. "&m1=".$_POST["m1"]."&d1=".$_POST["d1"]."&y1=".$_POST["y1"]."&m2=".$_POST["m2"]."&d2=".$_POST["d2"]."&y2=".$_POST["y2"]."&inboxcounter=".$_POST["inboxcounter"]."&sentcounter=".$_POST["sentcounter"]."&messagevariable=".$_POST["messagevariable"]. "&tran_id=".$_POST["mesgtran_ID"]);

exit;

}


//Print the message

if (isset($_POST["print"]))
{

header("Location: printMCtemplate.php?mess_id=".$_POST["mess_id"]. "&print=".$_POST["print"]. "m1=".$_POST["m1"]."&d1=".$_POST["d1"]."&y1=".$_POST["y1"]."&m2=".$_POST["m2"]."&d2=".$_POST["d2"]."&y2=".$_POST["y2"]);

exit;
}

$query = "UPDATE messages SET status=2 WHERE user_id='$userid' AND ID='$mess_id'";

mysql_query($query);


if ($user_auth == "2")
{
    $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,
  user_mgr.user_fname, user_mgr.user_lname, user_mgr.user_id, user_mgr.user_email
  FROM messages, user_mgr
  WHERE messages.ID='$mess_id'
  AND user_mgr.user_id = messages.user_id";
}
else
{
            $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"];


$icnquery="SELECT * from visit_mgr where palm_tran_ID='$mesgtran_ID'";
$icnresult=mysql_db_query("$database[dbname]", $icnquery);

$icnr = mysql_fetch_array($icnresult);

$visit_type=$icnr["visit_type"];
print ("VISIT TYPE is...: ". $visit_type);

$dcnquery="SELECT * from dcn where dcn_tran_ID='$mesgtran_ID'";
$dcnresult = mysql_db_query("$database[dbname]", $dcnquery);

$r = mysql_fetch_array($dcnresult);

$dcn_posted_for_billing=$r["dcn_posted_for_billing"];
$dcn_approved_for_billing=$r["dcn_approved_for_billing"];
$dcn_tran_id=$r["dcn_tran_ID"];[/code]
Link to comment
https://forums.phpfreaks.com/topic/33790-solved-header-problem-in-email/
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.