Can't put PHP form in a table

前端 未结 2 424
梦毁少年i
梦毁少年i 2021-01-28 00:52

I\'ve created a form which works fine, but when I put it in a table it always thinks the form is incomplete - is there a way I can put it in a table (so it looks nice!) without

相关标签:
2条回答
  • 2021-01-28 01:05
    <h2 class="green">Interested in making life easier?</h2>
    <form method="post" action="sendemail.php">
        <?php
        $ipi = getenv("REMOTE_ADDR");
        $httprefi = getenv ("HTTP_REFERER");
        $httpagenti = getenv ("HTTP_USER_AGENT");
        ?>
        <input type="hidden" name="ip" value="<?php echo $ipi ?>" />
        <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
        <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
        <table>
            <tr>
                <td><label for="visitor">Name:</label></td>
                <td><input type="text" name="visitor" size="25" /></td>
            </tr>
            <tr>
                <td><label for="visitoradd">Address:</label></td>
                <td><input type="text" name="visitoradd" size="25" /></td>
            </tr>
            <tr>
                <td><label for="visitorcity">City:</label></td>
                <td><input type="text" name="visitorcity" size="15" /></td>
            </tr>
            <tr>
                <td><label for="visitorpost">Postcode:</label></td>
                <td><input type="text" name="visitorpost" size="15" /></td>
            </tr>
            <tr>
                <td><label for="visitormail">E-mail:</label></td>
                <td><input type="text" name="visitormail" size="25" /></td>
            </tr>
            <tr>
                <td><label for="visitortel">Telephone Number:</label></td>
                <td><input type="text" name="visitortel" size="25" /></td>
            </tr>
            <tr>
                <td><label for="bp">Bookkeeping/Payroll:</label></td>
                <td>
                    <select name="bp" size="1">
                        <option value=" Bookkeeping">Bookkeeping </option>
                        <option value=" Payroll ">Payroll</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td><label for="transcations">Number of transactions:</label></td>
                <td><input type="text" name="transcations" size="15" /></td>
            </tr>
            <tr>
                <td><label for="employees">Number of employees:</label></td>
                <td><input type="text" name="employees" size="15" /></td>
            </tr>
            <tr>
                <td><label for="pmw">Payroll weekly/monthly:</label></td>
                <td>
                <select name="pmw" size="1">
                    <option value=" Weekly">Weekly</option>
                    <option value=" Monthly">Monthly</option>
                </select>
                </td>
            </tr>
        </table>
        <br />
        <INPUT TYPE="image" SRC="images/btnSubmit.png" ALT="Submit Form">
        <br />
    </form>
    
    0 讨论(0)
  • 2021-01-28 01:18

    Place the form tags outside of the table like so:

    <form>
      <TABLE>
      <TR>
        <TD>Name</TD>
        <TD><input type="text" name="visitor" size="25" /></TD>
      </TR>
      <TR>
        <TD>Address</TD>
        <TD><input type="text" name="address" size="25" /></TD>
      </TR>
      </TABLE>
    </form>
    

    If you are needing to specify width, height, etc.. then use CSS.

    Here is a great tutorial on it: http://www.w3schools.com/css/

    0 讨论(0)
提交回复
热议问题