After sharing the URL in whatsapp, it was not complete. It picks the URL up to ...http://example.com?s=$sender
. After $sender
, the URL end was not there.
<a class='' href='whatsapp://send?text=<?php echo "http://example.com/?s=$sender&r=$receiver&d=$d&m=$m"; ?>' data-action='share/whatsapp/share'>Share</p></div></a>
I was expecting the url (http://example.com?s=$sender&r=$receiver&d=$d&m=$m
)
but I only got (http://example.com?s=$sender
) in the whatsapp chat.
What is the solution to my problem?
you should learn how to concat between text and php
if you have variable var and equal to Abanoub
$var = "Abanoub";
and you want to echo hello $var you should do it as:
echo "Hello " . $var;
we use "." to concat between text and php var so you should write
<?php echo "http://example.com/?s=".$sender."&r=".$receiver."&d=".$d."&m=".$m; ?>
One solution I found. We can use the encoded URL in the WhatsApp link instead of decoded URL. I think used URL encoder in PHP.