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
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:
Link to comment
Share on other sites

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

Edited by JhunVW
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.