Millica Millica - 1 year ago 86
Javascript Question

How do I add php to a url?

I want to re-direct the link below in a javascript function, but I'm unsure how to properly call the php code listed after

. I've tried the example below and also
inbox.php?u=<?php $log_username; ?>
but it doesn't work. Can somebody guide me in the right direction?


Answer Source

You have missed the echo in the php tag. Try with:

window.location.replace("inbox.php?u=<?php echo $log_username; ?>");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download