0

我的问题是我有一个下拉框,可以根据我的选择加载内容。但是在其中一个页面中,我获得了内容,我有一个静态方法,我需要在显示内容之前调用它。所有方法都是检查是否在会话中设置了该值。如果是填充该字段。如果我使用 jquery ajax 加载内容,该方法似乎不会触发。这是我根据我的选择加载的 html:

    <table>
<tr>
<td><label class="required">Enter Current Number:</label></td><td><input type="text" size=13 id="current_number"  name="current_number" value="<?php echo Util::getSessionValuebySessionName("phonePorting", "current_number"); ?>"></td>
</tr>
<tr><td colspan="2"><strong>Please Enter the Address associated to your current phone number</strong>
NOTE: You may only keep your current phone number if the address of your current phone number is in the same state as the address where you are signing up for CenturyLink service. </td></tr>
<tr>
<td width=20%><label class="required">Address Line 1:</label></td><td><input type="text" size=25  id="address_line1"  name="address_line1" value="<?php echo Util::getSessionValuebySessionName("phonePorting", "address_line1"); ?>" ></td>
</tr>
<tr>
<td>Address Line 2:</td><td><input type="text" size=25  id="address_line2"  name="address_line2" value="<?php echo Util::getSessionValuebySessionName("phonePorting", "address_line2"); ?>"></td>
</tr>
<tr>
<td><label class="required">Apartment:</label></td><td><input type="text" size=5  id="Apartment"  name="Apartment"   value="<?php echo Util::getSessionValuebySessionName("phonePorting", "Apartment"); ?>"></td>
</tr>

<tr>
<td><label class="required">City:</label></td><td><input type="text" size=15  id="City"  name="City" value="<?php echo Util::getSessionValuebySessionName("phonePorting", "City"); ?>"></td>
</tr>
<tr>
<td><label class="required">State:</label></td><td><select  id="State"  name="State"   >
<option value="">Select a State</option>
<?php foreach (Util::getStatesCodes() as  $key => $value) {?>
<option value="<?php echo $key; ?>" <?php Util::getSessionValuebySessionName("phonePorting", "City")==$key)echo "selected";?>><?php echo $key; ?></option>  
<?php }?>
</select>
</td>
</tr>
<tr>
<td><label class="required">ZipCode:</label></td><td><input type="text" size=15  id="Zipcode"  name="Zipcode"  value="<?php echo Util::getSessionValuebySessionName("phonePorting", "Zipcode"); ?>" ></td>
</tr>
</table>

这是静态方法:

    public static function getSessionValuebySessionName($ssessionName, $keyName){

    if(!empty($_SESSION[$ssessionName][session_id()][0][$keyName]))
    {
        return $_SESSION[$ssessionName][session_id()][0][$keyName];
    }

因此,当我在下拉列表中进行选择时,如果 html 内容中的会话值不为空,我想要做的就是加载会话值(在文本字段中)。希望这是有道理的。

谢谢你。

4

1 回答 1

0

问题解决了。我忘了在构造函数中启动会话.....

于 2013-10-15T14:39:28.270 回答