Skip to content Skip to sidebar Skip to footer

Two "form Action's" On One Line

I have just finished putting a login and register bit on my website and now I'm just cleaning things up, but then I came to this problem I have two form action's on one page, each

Solution 1:

<span style="float:left;">
    <form action='logout.php' method='POST'>           
        <input type='submit' value='Logout' />      
    </form>   
</span>
<span style="float:right;">
    <form action='changepassword.php' method='POST'>     
        <input type='submit' value='Change password' />       
    </form>
</span>

Solution 2:

If I understand your question properly, I think you need to use some CSS:

form {
    float: left;
    width: auto;
}

You might want to add a class to those forms to stop yourself styling all forms like this


Solution 3:

Here's the dirty inline version

<form action='logout.php' method='POST' style='float:left;'>           
<input type='submit' value='Logout' />      
</form>                      
<form action='changepassword.php' method='POST'>     
<input type='submit' value='Change password' />       
</form>

Of course James's suggestion to use a class is the proper way to do it.

Btw, those forms should be after the opening body tag.


Post a Comment for "Two "form Action's" On One Line"