Jump to content

Storing <a href> to a variable


JhunVW

Recommended Posts

Hello,

 

Is it possible to store an <a href= > to a variable, like this:

 

$link_add = "<a href='http://www.yahoo.com'>here</a>";

$message      = "If you want to continue this transaction, please click " .  $link_add;
 
My output look like this:
 
If you want to continue this transaction, please click <a href=http://www.yahoo.com>here
 
instead of:
 
If you want to continue this transaction, please click here
 
I also tried this:  
 
$link_add = echo "<a href='http://www.yahoo.com'>here</a>";
 
still not correct.
 
Please help.
 
Thanks.
 
Jhun
Link to comment
https://forums.phpfreaks.com/topic/297118-storing-to-a-variable/
Share on other sites

The following code works for me:

<?php
$link_add = "<a href='http://www.yahoo.com'>here</a>";
$message  = "If you want to continue this transaction, please click " .  $link_add;
print $message;
?>
 
Are you using a function like htmlentities() on $message before it's displayed? What does your echo statement for $message look like? Note: please surround your code with

tags. It makes your post and code easier to follow.  :happy-04:

Hi CyberRobot,

 

Thanks for your immediate response.

 

My apology, I failed to mention that I am sending the message thru SMS and not just printing it. Here's part of the codes:

<?php
$link_add = "<a href='http://www.yahoo.com'>here</a>";
$message  = "If you want to continue this transaction, please click " .  $link_add;

$unicode      = "";
		
$_objSmsProtocolGsm->Logfile = "C:\SMSMMSToolLog.txt";
		
//Clear the messageobject first
$objMessage->Clear();
		
$objMessage->Clear();
		
if( $recipient == "" ) die("No recipient address filled in."); 
	$objMessage->Recipient = $recipient;
		
	if( $unicode != "" ) $objMessage->Format = $objConstants->asMESSAGEFORMAT_UNICODE;
		
			$objMessage->Data = $message;
			$_objSmsProtocolGsm->Clear();		
			$_objSmsProtocolGsm->Device = $device;

... rest of codes work fine here!
?

If you want to continue this transaction, please click <a href=http://www.yahoo.com>here  <- this is the ouptut in my SMS.

 

Best regards,

 

Jhun

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.