0

I want to redirect to a page using a <button> tag.. however, it's not working

<?php $url2 = "mission_schedule.php?id=" . urlencode($_GET['id']);?>

    <!-- this is not working -->        
    <button onclick=location.href='<?php echo $url2; ?>'; >Next</button>

    <!-- this is working -->           
    <a href="<?php echo $url2;?>">Next</a>

clicking the button reloads the same page.. while clicking the link redirects me to the right page In addition, this button works in other pages normally

imuharram
  • 1
  • 1

1 Answers1

0

Missing double quotes:

<button onclick="location.href='<?php echo $url2; ?>';">Next</button>
Ricardo Pontual
  • 3,749
  • 3
  • 28
  • 43