There is a text variable defined like this:

$text = "(Автоматически сгенерированное сообщение) вы приглашены для вступления в коалицию ".$myrowcoal['name']." для ознакомления перейдите по ссылке \nhttp://www.nw.com/coalition.php?id=".$id."\n"; 

The problem is that when the text of this variable is transmitted by a message on the site to the user, it looks like text, not like a link.

How can you make it so you can click on it?

  • tried again like this $ text = "(Automatically generated message) you are invited to join the coalition for". $ myrowcoal ['name']. "click on the link <a href = 'coalition.php? id =" . $ id. "> Link </a>"; but when outputting in a message, it simply gives out "(Automatically generated message) you are invited to join the Hyas Code coalition. For reference, click on the link" without a piece of html - DanteLoL

3 answers 3

 $text = "(Автоматически сгенерированное сообщение) вы приглашены для вступления в коалицию ".$myrowcoal['name']." для ознакомления перейдите по ссылке \n<a href='http://www.nw.com/coalition.php?id=".$id."'>http://www.nw.com/coalition.php?id=".$id."</a>\n"; 

So?

  • Yes, the message has worked but is not entered into the database ((($ text = "(Automatically generated message) you are invited to join the coalition". $ myrowcoal ['name']. "" for acquaintance, click the link \ n <a href = ' nw.com/coalition.php ? id = ". $ id."'> nw.com/coalition.php?id=".$id ." </a> \ n "; $ result0 = mysql_query (" INSERT INTO dialogues (id1, id2, date, text, stat) VALUES ('$ myrow2 [id]', '$ iduser', '$ date', '$ text', '1') ", $ db); // we put in the message base - DanteLoL
  • Does it come only if you remove \ n <a href = ' nw.com/coalition.php ? id = ". $ id." '> nw.com/coalition.php?id=".$id ." </a> \ n - DanteLoL
  • and you will pass the message through mysql_real_escape_string - Arc
 echo $text = "(Автоматически сгенерированное сообщение) вы приглашены для<br> вступления в коалицию ".$myrowcoal['name']." для ознакомления перейдите по ссылке."." <a href='coalition.php?id=".$id."'>Ссылка</a>"; 
  • the same story as above is not entered in the database \ - DanteLoL

figured it out

 $text = "(Автоматически сгенерированное сообщение) вы приглашены для<br> вступления в коалицию ".$myrowcoal['name']." для ознакомления перейдите по ссылке http://www.nw.com/coalition.php?id=$id"; 

and using the function

 function link_it($text) { $text= preg_replace("/(^|[\n ])([\w]*?)((ht|f)tp(s)?:\/\/[\w]+[^ \,\"\n\r\t<]*)/is", "$1$2<a href=\"$3\" >$3</a>", $text); $text= preg_replace("/(^|[\n ])([\w]*?)((www|ftp)\.[^ \,\"\t\n\r<]*)/is", "$1$2<a href=\"http://$3\" >$3</a>", $text); $text= preg_replace("/(^|[\n ])([a-z0-9&\-_\.]+?)@([\w\-]+\.([\w\-\.]+)+)/i", "$1<a href=\"mailto:$2@$3\">$2@$3</a>", $text); return($text); } 

turned into a link

 $text = link_it($text); 

and it all worked) thank you all for your assistance)