【问题标题】:Change image of Submit button更改提交按钮的图像
【发布时间】:2011-01-29 10:55:53
【问题描述】:

我想更改表单的提交按钮。我设法做到了,而且很简单,但是代码中断了。当我修复代码时。提交按钮变回其默认图像,并表示提交我没有初始化的查询。从那以后,我还没有想出如何解决它。这很奇怪。

<?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>";
?>

我把它传递给这个

<?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);
?>

但是,它不起作用(变量无法获取它)。我应该用“提交”更改“图像”。但是如果我这样做,那么图像将是默认的。

简而言之

type='SUBMIT' -> 我可以让代码工作,但默认图片。

type='image' -> 我得到了漂亮的图像,但代码不起作用。

【问题讨论】:

    标签: php javascript html forms


    【解决方案1】:

    您可以使用 css 设置按钮的背景图像。

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

    (最好使用单独的样式表)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-12-27
      • 1970-01-01
      • 2011-10-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-17
      相关资源
      最近更新 更多