0

I am trying to create the necessary url from this code however it is working and I am struggling to find out why.

$linkere = $row['message'];
echo '<a href="me.php?message=<?php echo rawurlencode($linkere); ?>">'

Currently this code is producing the url: me.php?message= . But, I would like it to create the url: me.php?message=hello for example.

Thanks for helping!

0

4 Answers 4

2

You are passing $linkere to rawurlencode(). The variable is actually named $linker.

$linker = $row['message'];
echo '<a href="me.php?message=<?php echo rawurlencode($linker); ?>">'
Sign up to request clarification or add additional context in comments.

2 Comments

It still doesn't work for some reason - thanks anyway!
Your answer still contains the syntax errors that are causing the root issue. There are now three duplicate answers to this questions that solve the issue.
0

You have alot of syntax problems here.

first, you need to use Concatenation message='.rawurlencode($linker).'" second your variable do not exist, it should be $linker.

Second close the tag and insert the text, in this case i used Test.

$linker = $row['message'];
echo '<a href="me.php?message='.rawurlencode($linker).'">Test</a>';

3 Comments

So is this ok: '<b><a href="me.php?message='.rawurlencode($linkere);'">' . $row['title']. '</a></b><br>' . $row['message'];
No, '.rawurlencode($linkere);'" it should be '.rawurlencode($linkere).'" , notice the "." (dot) after $linkhere)
To continue with what Jorge said, the semicolon in your string escape will end the echo entirely. Use this: echo '<b><a href="me.php?message='.rawurlencode($linkere).'">' . $row['title']. '</a></b><br>' . $row['message'];
0

Can you try this,

 $linker = $row['message'];
 echo '<a href="me.php?message='.rawurlencode($linker).'">YOUR LINK TEXT HERE</a>';

Comments

0

You don't need the <? ?> and echo in your echo, it should just be:

$linkere = $row['message'];
echo '<a href="me.php?message='.rawurlencode($linkere).'">Test</a>';

Otherwise you are turning php on and off again to echo something within an already open instance of php in which you are already echoing.

2 Comments

code echo '<br><br><br><br><br><b><a href="me.php?message='.rawurlencode($linkere);'">' . $row['title']. '</a></b><br>' . $row['message'];
It works for me when I copied and pasted the code back in. I updated the entire section though with your code and more robust link text. Try it now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.