Brett Powell Brett Powell - 5 months ago 22
HTML Question

Wrapping Input Button in A HREF

I am trying to get a button to link to a URL by wrapping the input button in a href. When I click the button, it does not do anything at all, even though the source shows it as having the proper syntax. I have also tried changing it to use an onClick() method in the button as well with no luck.

<a href='" . htmlentities($console) . "'><input type='button' style='width:100px' value='Provision'></a>


The URL when viewed via the page source is shown as...

<a href='https://prov.domain.net/novnc/console.php?uuid=943b37ef-46a8'><input type='button' style='width:100px' value='Provision'></a>

Answer

Use:

<input type="button" onclick="window.location.href = 'https://prov.domain.net/novnc/console.php?uuid=943b37ef-46a8'; return false;" style='width:100px' value='Provision'>