开发者

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 one goes to a different page, easy enough, but I can't seem to get them both on one line.

Here is the code for the form actions:

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

I've tried

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

but both buttons go to the same location

the website is www.crossception.com, you will need to login to get to this problem I've already开发者_Go百科 made a login and password for every one to use username : stackoverflow password : test101

thank you very much

connor

(aged 15)


<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>


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜