Change image of Submit button

12,462

You can just set the background image of the button using css.

<input type="submit" style="background-image: url(bgb.png);" />

(Better to use separate style sheet off course)

Share:
12,462
Ivan Reuben Ramos Muit
Author by

Ivan Reuben Ramos Muit

Updated on June 06, 2022

Comments

  • Ivan Reuben Ramos Muit
    Ivan Reuben Ramos Muit almost 2 years

    I wanted to Change the submit button of my form.I manage to do it and Its quite easy however the code breaks. When i fixed the code. The submit button changes back to its default image and it said submit query which i did not initialize. I have not figured out how to fix it since then. Which is weird.

    <?Php
        echo "<div style='text-align:right'>
           <form action='upd2.php' method='POST'>
           <Table border='0' align='right'>
           <tr>
            <td ><font size='-3'>ID Search</font></td>
            <td rowspan =2><input name='image' type='image' id='SUBMIT' src='images/_Images_buttons_search_button.jpg'></td>
           </tr>
           <tr>
            <td><input name='ID_NO' type='text' id='ID_NO'></td>
           </tr>
           </table><br>
           </FORM> </div>";
    ?>
    

    I pass it on to this

    <?php
        print "<H2>Update User Info</H2>";
    
        $ID_NO   = clean($_POST['ID_NO']);
     $_SESSION["ID_NO"] = $ID_NO;
         if (isset($_POST['image'])) {
            $result = mysql_query("SELECT * FROM user_info WHERE ID_NO = '$ID_NO'");
            if(!mysql_num_rows($result)) {
                print "<BR><BR>There is no such User with a User Number of $ID_NO <BR><A HREF ='UpdateUser.php'>Go Back</A>";
         exit();
            }
            else {
                $row_array = mysql_fetch_array($result, MYSQL_ASSOC);
    ?>
    

    however, it does not work(the variable wasnt able to get it). I should have change "image" with "SUBMIT". But if I do that, then the image would be in default.

    so in short

    type='SUBMIT' -> i get to make the code work but default picture.

    type='image' -> i get the nice image but the code wont work.