Search code examples
phpechohref

Simple location.href with php echo in in link


I have pretty straight forward question:

What would be the correct syntax for this be?

onclick="location.href = '/xxx/xxx?key='.'<? $value[0]->pass_key; ?>'"

At the moment, this redirect's to my page /xxx/xxx/?key, but leaves out my pass_key, which i need to generate data on the resulting page.

UPDATE

Was a mistake not to use

    <?= ?> 

which is the same as

   <? echo ?>

I've updated it in my code still no key is passed along.

This statement resides in this tag:

   <td>

SOLVED

Thx to chinnu and y'all!

And what's up with the downvote? :( just because it's a simple mistake/question. .

Prudes.


Solution

  •   onclick="location.href = '/xxx/xxx?key=<?php echo $value[0]->pass_key; ?>'"