0

我正在尝试进行表格查找。我填写字段,然后单击组合框进行查找。当我返回页面时,姓氏字段变为空白。当我返回页面时,我需要一种保留字段数据的方法。

<?php /*?>
<?php if(isset($_POST['First'])) { echo htmlentities ($_POST['First']); }?>
<?php */?>

<tr valign="baseline">
    <td nowrap="nowrap" align="right">Last Name:</td>
    <td><input type="text" name="Last_Name" id="Last_Name" autofocus value="" placeholder="last name" size="32" /></td>
</tr>
<tr valign="baseline">
    <td nowrap="nowrap" align="right">City:</td>
    <td>
        <select name="LookupCity" id="LookupCity">
            <option value="" 
                <?php if (!(strcmp("", $_GET['City']))) {echo "selected=\"selected\"";} ?>>
                Select from menu
            </option>
            <?php do { ?>
            <option value="<?php echo $row_fmCity['City']?>"<?php if (!(strcmp($row_fmCity['City'], $_GET['City']))) {echo "selected=\"selected\"";} ?>><?php echo $row_fmCity['City']?>
            </option>
            <?php
                } while ($row_fmCity = mysql_fetch_assoc($fmCity));
                $rows = mysql_num_rows($fmCity);
                if($rows > 0) {
                    mysql_data_seek($fmCity, 0);
                    $row_fmCity = mysql_fetch_assoc($fmCity); 
                }
            ?>
        </select>
        <a href="ZipLookup.php?Last Name=<?php echo $Last_Name ?>">select</a>
    </td>

请举个例子。

4

1 回答 1

0

只需设置控件的“值”属性。

于 2013-02-20T13:59:44.330 回答