Havoux Havoux - 5 months ago 22x
Javascript Question

PHP Concatenate Variable in URL string

<td><input type="submit" onClick="window.location.href='https://www.'.$myVariable.'.test.com'" value="Click!"></td>

I have a button that should go to 1 of 8 possible url's - I have the logic to get the variable however I seem to run into an issue here. I get an error saying

Unresolved Variable: $myVariable

Is this because I am within a HTML table?

I even tried using
between the strings and still didnt work. Am I missing something obvious?


Just output php variable inside one string:

<td><input type="submit" onClick="window.location.href='https://www.<?php=$myVariable; ?>.test.com'" value="Click!"></td>