Hack Forums
[PHP] Button Automatically Redirecting Without Being Clicked - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Web Development (https://hackforums.net/forumdisplay.php?fid=183)
+---- Thread: [PHP] Button Automatically Redirecting Without Being Clicked (/showthread.php?tid=5940290)



Button Automatically Redirecting Without Being Clicked - Effexion - Feb 12, 2019

PHP Code

<?php 
<input type="button" name="submit" value="Sign Up" class="button btn-primary" onClick="<?php header("Location: https://link.com");?>"/> 

It doesn't even wait for a click, just redirects as soon as I open the page. Any ideas?

EDIT: FIxed it with:

PHP Code

<?php 
<input type="button" name="submit" value="Sign Up" class="button btn-primary" onClick="document.location.href='https://link.com'" />