Hello all!!! Thank you Brett(bpat1434) I am still having a problem. I will be so happy to have this work correct.
section #1 works until I add section #2
After I add section #2 and send using $SESSION['grade'] = "1" it skips section #1 and Redirects using section #2 which tells me its not reading the $SESSION['grade'] = "1". But if I send using a $_SESSION['grade'] = "2" it works.
Can you help me again..... Thank you so much......
<?php
include('../../include/csm.php');
if(isset($_POST['submit'])){
$query = "SELECT * FROM users WHERE mem_id='$mem_id_to'";
$result = mysql_query($query) or die('MySQL Error: ' . mysql_error());
while($row = mysql_fetch_array($result))
{
if($row['grade'] == '')
// section #1 This section of code works until I add section #2
// I think the problem is its not reading the $SESSION['grade']
// When I add section #2 and send using a $SESSION['grade'] ="1" it goes to #2 section which is wrong.
$SESSION['grade'] = "1";
IF ($row['grade'] == '1') {
header("location:/mail/ps_mail/membermail_sentps.php");
}
ELSEIF ($row['grade'] == '2') {
header("location:/mail/ps_mail/membermail_sentps.php");
}
ELSEIF ($row['grade'] == '3'){
header("location:/mail/ps_mail/membermail_sentpsg.php");
}
ELSEIF ($row['grade'] == '4'){
header("location:/mail/ps_mail/membermail_sentpsp.php");
}
// section #2 This section of code works if I log in using $SESSION['grade'] ="2"
$_SESSION['grade'] = "2";
IF ($row['grade'] == '1') {
header("location:/mail/s_mail/membermail_sents.php");
}
ELSEIF ($row['grade'] == '2') {
header("location:/mail/s_mail/membermail_sents.php");
}
ELSEIF ($row['grade'] == '3'){
header("location:/mail/s_mail/membermail_sentsg.php");
}
ELSEIF ($row['grade'] == '4'){
header("location:/mail/s_mail/membermail_sentsp.php");
}
}
$mem_id_from = $SESSION['mem_id'];
$mem_id_to = addslashes($POST['mem_id_to']);
$subject = addslashes($POST['subject']);
$message = addslashes($POST['message']);
$date = date(YmdHis);
$type = ('email');
$create = "INSERT INTO mail (mem_id_to, mem_id_from, subject, message, sentdate, status, type, grade)
VALUES ('$mem_id_to','$mem_id_from','$subject','$message','$date','unread', '$type', '$grade')";
$create2 = mysql_query($create) or die("A letter could not be sent to $mem_id_to!");
}
?>