Small PHP button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • HACKhalo2
    New Member
    • Jul 2008
    • 2

    #1

    Small PHP button

    Hello. I want to make a PHP button that's small. Problem is, all my attempts either screwed up the layout or needed MUCH more code than i want to do. The page I'm using is set up with tables, if that helps any

    My first attempt was to use a <span> tag with a javascript function, which gave me the layout i wanted, but in order to transfer the javascript functions to PHP, i need a JSP page to right it to the Database, which confuses the devil out of me, or a way to transfer the variables from javascript to PHP without adding hundreds of lines of code.

    My second attempt was to make an image button using the <INPUT> tag, which gave me the function i wanted, but it screwed up the layout, since the first instance (which is in a while php function) is always elongated (like, it would make the division between the title and the message have a gap bigger than what i want), but after that, all of them look fine.

    How it works:
    Basically, using the <Form> tag with no attributes, a button, and a hidden field, set up like so:
    Code:
    <? if ($var1) mysql_query("query"); ?>
    HTML stuff
    <?php stuff
    echo "<FORM><TR><TD colspan=4 align=right><INPUT type=hidden name=target value='{$messages_row[datetime]}'>";
    echo '<INPUT type=submit value="button" name="var1"></TD></TR></FORM>';
    so when the page reloads itself, the query is executed. Not the prettiest code wise, but it works.

    The question:
    Is there anyway to make a button small (13x10 Pixels), layout friendly (no PNG image), and also not use a ton of code to do what i want?

    Thanks,
    Hh2
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Use css to acheive this:

    Code:
    <style type="text/css">
    .small_button{
        width: 13px;
        height: 10px;
    }
    </style>
    
    <input type="button" class="small_button" value="This is a small button!" />

    Comment

    Working...