Hi i don't know if someone had this problem
got some strange thing happen here
i'm using mail function like this one ( the one with { red color code } actualy a php code or php variable i just sensor it )
{some sql code here for dynamic id, dynamic id for anchors, dynamic name and place }
$to = {dynamic code}
$subject = {dynamic subject }
$message =
' '.{dynamic name}.' want to share review of .{dynamic place}.'
<br/>
Click on the link below to read review
<br/>
<a href="http://myweb/info.php?id='.{dynamic id}.'#'.{dyanamic id for anchors}.'">Link</a>';
$subject ={dynamic name}.' want to share a review';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: '.{dynamic email}.'('.{dynamic name}.')' . "\r\n";
$mail_sent = mail( $to, $subject, $message, $headers );
OK nothing wrong with the sql getting the data all work well
except the result i get in my mail (gmail) is this
--------------------------------------------------------------------------------------------------------------------------------
{dynamic name -> we got the name } want to share review of { dynamic name -> wasn't there }
Click on the link below to read review
Link
--------------------------------------------------------------------------------------------------------------------------------
when i hover the link and check the link address it comes out like this
http://myweb/info.php?id=#{dynamic id}#{dyanamic id for anchors}
it added # itself in front of {dynamic id} the id is correct though
now a click on the link and this is what show in my url address bar
http://myweb/info.php?id=#{dynamic id}%32{dyanamic id for anchors}
can someone shed me some light
the {dynamic id } and {dynamic id for anchors} is number only no comma
PHP mail HTML mode with complex a href ... strange result
Moderator: General Moderators
Re: PHP mail HTML mode with complex a href ... strange result
Try using the urlencode function just in case any characters coming back from the db are causing the issue. Also, it would be much more helpful to see actual code.
Re: PHP mail HTML mode with complex a href ... strange result
ok i give up ,.... no idea
here is my code
$post is an array and the data from $post is show correctly in the email i received but not from database
i try using urlencode but still no luck
here is my code
$post is an array and the data from $post is show correctly in the email i received but not from database
i try using urlencode but still no luck
Code: Select all
public function sendemail ($post) {
$random_hash = md5(date('r', time()));
$search_str = "SELECT compound_id,compound_name FROM review WHERE review_id = ".$post['review_shareid'];
$search_q = mysql_query($search_str);
$search = mysql_fetch_assoc($search_q);
$comname = $search['compound_name'];
$comid = $search['compound_id'];
$to = $post['review_friendemail'];
$name = $post['review_name'];
$myemail = $post['review_myemail'];
$message =
' '.ucfirst($name).' has sent you a link to a review of '.urlencode(ucfirst($comname)).'
<br/>
Click on the link below to read the review
<br/>
<a href="http://lihong/compound-info.php?cid='.urlencode($comid.'#'.$post['review_shareid']).'">Complex Review '.$random_hash.'</a>';
$subject = $name.' want to share a review';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: '.$myemail.'('.$name.')' . "\r\n";
$mail_sent = mail( $to, $subject, $message, $headers );
}