2

我的任务是重用已经在公司网站上实施的 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>

我应该怎么做才能使这个表格工作?

4

1 回答 1

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

我得到现场演示

POST
Array
(
    [first_name] => 
    [last_name] => 
    [email] => 
    [phone] => 
    [street_address] => 
    [address2] => 
    [city] => 
    [state] => 
    [zip] => 
    [country] => 0
 )
于 2013-07-01T12:59:19.377 回答