HTML表单无法提交

时间:2013-07-01 11:37:13

标签: html forms

我被赋予了重新使用已在公司网站上实施的HTML表单的任务。

所有表单都是:抓取一些个人信息输入并将其发送到处理脚本。

我的任务是创建一个在iPad上本地托管的页面,在mobiel Safari上打开。然后,该页面应将表单值发送到Web服务器上托管的处理脚本。

我制作了表单的确切副本,但由于某种原因,我的副本不起作用:脚本没有收到任何值。

以下是表单的代码(为了简洁起见,减去列表中的几个国家/地区):

<form id="contact_form" action="http://mycompany.formprocessor.com/process/" method="post" accept-charset="utf-8">          
    <fieldset>

        <h3>1. Personal information</h3>
        <div>
            <label for="first_name">First Name</label>
            <input class="required" name="first_name" id="first_name" type="text" tabindex="10" value="" />
        </div>

        <div>       
            <label for="last_name">Last Name</label>
            <input class="required" name="last_name" id="last_name" type="text" tabindex="20" value="" />
        </div>

        <div>
            <label for="email">Email</label>
            <input class="required" name="email" id="email" type="text" tabindex="30" value="" />
        </div>          
    </fieldset>

    <fieldset>
        <h3>2. Contact information</h3>

        <div>       
            <label for="phone">Phone</label>
            <input class="required" name="phone" id="phone" type="text" tabindex="40" value="" />
        </div>

        <div>
            <label for="street_address">Street Address</label>
            <input name="street_address" id="street_address" type="text" tabindex="50" value="" />

            <label><em>(continued)</em></label>
            <input name="address2" id="address2" type="text" tabindex="60" value=""  />
        </div>

        <div>
            <label for="city">City</label>
            <input name="city" id="city" type="text" tabindex="70" value="" />
        </div>

        <div>       
            <label for="state">State/Province</label>
            <input name="state" id="state" type="text" tabindex="80" value="" />
        </div>

        <div>       
            <label for="zip">Zip/Postal</label>
            <input class="required" name="zip" id="zip" type="text" tabindex="90" value="" />
        </div>


        <div>
            <label>Your Country:</label>
            <select name="country" id="country" tabindex="93">
                <option value="0">Select...</option>
                <option value="Afghanistan">Afghanistan</option>
                <option value="Antarctica">Antarctica</option>
                <option value="Bouvet Island">Bouvet Island</option>
                <option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option>
                <option value="Djibouti">Djibouti</option>
                <option value="Eritrea">Eritrea</option>
                <option value="Faroe Islands">Faroe Islands</option>
                <option value="Greenland">Greenland</option>
                <option value="Heard Island and McDonald Islands">Heard Island and McDonald Islands</option>
                <option value="Kazakhstan">Kazakhstan</option>
                <option value="Lithuania">Lithuania</option>
                <option value="Mongolia">Mongolia</option>
                <option value="Niue">Niue</option>
                <option value="Poland">Poland</option>
                <option value="Portugal">Portugal</option>
                <option value="Romania">Romania</option>
                <option value="South Georgia and the South Sandwich Islands">South Georgia and the South Sandwich Islands</option>
                <option value="Spain">Spain</option>
                <option value="Togo">Togo</option>
                <option value="Ukraine">Ukraine</option>
            </select>   
        </div>  
    </fieldset>

    <div class="submit">
        <input id="submit" type="submit" value="Submit"  /> 
    </div>
</form>

我该怎么做才能使这个表格有效?

1 个答案:

答案 0 :(得分:1)

你的HTML工作 - 特别是如果你把它包装在

<!DOCTYPE html>
  <html>
    <head>
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <title>...</title>
    </head>
    <body>...</body>
  </html>

我使用这个php测试了它:

<?php
echo $_SERVER['REQUEST_METHOD'];
print('<pre>');
print_r($_REQUEST);
print('</pre>');
?>

我得到Live Demo

POST
Array
(
    [first_name] => 
    [last_name] => 
    [email] => 
    [phone] => 
    [street_address] => 
    [address2] => 
    [city] => 
    [state] => 
    [zip] => 
    [country] => 0
 )