SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: disable submit

  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2008
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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>

  2. #2
    Guru in training bronze trophy SoulScratch's Avatar
    Join Date
    Apr 2006
    Location
    Maryland
    Posts
    1,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <?php if ( $active == '1' ) { ?>
    something
    <?php } else { ?>
    something.
    <?php ?>
    Cross browser css bugs

    Dan Schulz you will be missed

  3. #3
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.).
    Birnam wood is come to Dunsinane

  4. #4
    SitePoint Enthusiast
    Join Date
    Sep 2008
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you SoulScratch, it works perfect.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •