-
disable submit
Hey,
how can I use an if-else structure inside (or outside) a form to enable/disable a submit button? (I know the code below is wrong but I only want to describe my 'problem'.):
HTML Code:
<form action="text.php" method="get">
<label>Name: <input type="text" name="name" >
</label><br >
if ($active == "1")
{<input type="submit" value="GO" >}
else
{<input type="submit" value="GO" disabled ="disabled" >}
</form>
-
PHP Code:
<?php if ( $active == '1' ) { ?>
something
<?php } else { ?>
something.
<?php } ?>
-
This is not possible with HTML, which is a markup language, not a programming language.
Let me know what server-side technology is available to you, and I'll move this thread to the appropriate forum (PHP, .NET, etc.).
-
Thank you SoulScratch, it works perfect.