- PHP

How to make Button Unclickable in PHP

If you want to make your button unclickable, use the HTML disabled.

<button name="someName" disabled>My button</button>

Output:

If you want to do this on Some PHP condition, you can approach it like in this example:

<?php

$x = 2;

?>

<button name="myButton" <?php if($x == 2) { echo 'disabled'; } ?>>My button 2</button>

Output: