well, one problem solved, another one cropped up. Its removing the line breaks. If i use a selected response, it shows up properly in the text area, but when i hit answer and get the email, its one large run on paragraph.
this is what i get
test has been replied to by richei.
Hi richard,
Please provide me with the following: Label Name (Artist Name if Unsigned), PayPal E-mail, and Country.
From there we’ll go ahead and create your account so you can begin uploading your music to iTunes.
Please let us know if you have any questions - Richard Rowlands
Please use this link to reply.
but its supposed to be
test has been replied to by richei.
Hi richard,
Please provide me with the following: Label Name (Artist Name if Unsigned), PayPal E-mail, and Country.
From there we’ll go ahead and create your account so you can begin uploading your music to iTunes.
Please let us know if you have any questions - Richard Rowlands
Please use this link to reply.
That’s how it is in the database. I’m not sure if its because of the replacement process or what, it i need to get it fixed asap.
The strange thing is that if i type a message, everything works fine. Code is below
[php]<?php
require_once ‘config.php’;
require_once ‘functions.php’;
$id = $_GET[‘id’];
$qry = mysql_query(“SELECT * FROM venzo_contactus WHERE id = ‘$id’”);
$end = 0;
if(isset($_GET[‘end’])) {
$end = 4;
}
if(mysql_num_rows($qry) == 0) {
echo “There was no record found with the id of $id”;
} else {
$r = mysql_fetch_assoc($qry);
if(empty($r['last_answered_by'])) {
$ans = "";
} else {
$val = explode(', ', $r['last_answered_by']);
$ans = end($val);
}
}
if(isset($_POST[‘close’])) {
$id = $_POST[‘id’];
$req_id = $_POST[‘req_id’];
$up = mysql_query("UPDATE venzo_contactus SET status = 0 WHERE id = $id AND req_id = '$req_id'") or exit(mysql_error());
if($up) {
$suc = "This message has been successfully closed.";
$end = 1;
}
}
if(isset($_POST[‘Answer’])) {
$id = $_POST[‘id’];
$req_id = $_POST[‘req_id’];
$find = mysql_query("SELECT * FROM venzo_contactus WHERE id = '$id'");
$f = mysql_fetch_assoc($find);
if(!empty($r['last_answered_by'])){
if(strstr($r['last_answered_by'],$_SESSION['adminname'])){
$temp = explode(', ',$r['last_answered_by']);
$temp = array_filter($temp,filterArray);
$str = implode(', ', $temp);
$str .= ', '.$_SESSION['adminname'];
} else {
$str = $f['last_answered_by'].", ".$_SESSION['adminname'];
}
} else {
$str = $_SESSION['adminname']; //Just have it one its own
}
$status = 3;
//for default answer
$uname = $_POST['u_name'];
$aname = $_POST['a_name'];
//replace template variables
$find = array('%name%', '%admin%');
$repl = array($uname, $aname);
$ansr = str_replace($find, $repl, $_POST['n_answer']);
if(empty($r['answer'])) {
$ansrs = add_slashes_recursive($ansr);
$up = mysql_query("UPDATE venzo_contactus SET last_answered_by = '$str', answer = '$ansrs', status = $status WHERE id = $id AND req_id = '$req_id'") or exit(mysql_error());
} else {
$ansrs = '\r\n'.add_slashes_recursive($ansr);
$up = mysql_query("UPDATE venzo_contactus SET last_answered_by = '$str', answer = CONCAT(`answer`, '{$ansrs}'), status = $status WHERE id = $id AND req_id = '$req_id'") or exit(mysql_error());
}
if($up) {
$suc = $f['subject']." has been successfully updated.<br />An email has been dispatched to ".$f['name'].", notifying the user that their question has been answered.";
$end = 1;
$headers = 'From: [email protected]' . "\r\n";
$headers .= 'X-Mailer: PHP/' . phpversion();
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
//$t = explode("\n", $_POST['n_answer']);
/*if(in_array($find, $t)) {
$replace = array($uname, $aname);
$ansr = str_replace($find, $replace, $t);
$ansr = add_slashes_recursive($ansr);
}
$put = end($t);*/
//Venzo Support [ID] [Topic]
$sub = "Venzo Support Request ID: ".$f['req_id']."";
$message = "
<html>
<body>
$f[subject] has been replied to by $_COOKIE[adminuser].<br />
<br />".
//strip_slashes_recursive($put)
nl2br(stripslashes($ansr))
."<br /><br />
Please use this <a href='http://vmg.venzodigital.com/public_check_inquiries.php?req_id=$req_id'>link</a> to reply.
</body>
</html>";
mail($f['email'], $sub, $message, $headers);
}
}
?>
Untitled Document
Name: <?=$r['name']?> |
Email: <?=$r['email']?> |
Phone: <?=$r['phone']?> |
Submitted on: <?=$r['createdon']?> |
Updated on: <?=$r['date']?> |
Updated by: <?=$ans?> |
<?=nl2br(strip_slashes_recursive($r['message']))?>
|
Answered by: <?=$r['last_answered_by']?> |
<?php if($end == 1) { ?>
<?php } else { ?>
<div style="float: right; width: 100px;">
<select name="danswer" id="danswer" >
<?php
$ans = mysql_query("SELECT * FROM venzo_contactus_answers") or die(mysql_error());
while($row = mysql_fetch_array($ans)) {
echo "<option value='$row[id]'>$row[name]</option>";
}
unset($row);
?>
</select>
</div>
<div style="float: right; width: 100px;">
<input type="button" id="a_select" name="select" value="Select" onclick="ajaxFunction();"/>
</div>
<input type="hidden" name="id" value="<?=$id?>" />
<input type="hidden" name="req_id" value="<?=$r['req_id']?>" />
<?=nl2br(strip_slashes_recursive($r['answer']))?>
<?php } ?>
[/php]