0

How can I put something like *332*18747586# as value in href="" in HTML? I want to top up and the string we use to top up in our country is something like *332*18747586#

The following is my sample code

<?php
   $a="*332*18747586#";
   $aa=(string)$a;
?>

<a href="tel:<?php echo $aa; ?>">Click Here To Top Up</a> 

But the result is *332*18747586, href does not take #.
How can I include # in my result?

Syscall
  • 19,327
  • 10
  • 37
  • 52
Schadrack Rurangwa
  • 413
  • 12
  • 28

1 Answers1

0

# has a special meaning in URLs. It is used to denote the fragment of the URL, and you need to escape it to use it in the URL.

Replace # with %23 and it will work.

<a href="tel:*332*18747586%23">Click Here To Top Up</a>
31piy
  • 23,323
  • 6
  • 47
  • 67