I am trying to use the session code but I am so confused I don't know what to put where. Could you please put the whole code without the replace this with that, because I don't have the "this" exactly as you have it so it doesn't make sense.
This is what I have:
Code:
<p><label>* Agent:</label>
<select name="agent">
<?php
$agent = array('DD'=>'Debbie','JV'=>'Joanne','HS'=>'House');
//immediately above the foreach loop, add this:
$agent = '';
if (isset($_SESSION['agent'])) { $agent=$_SESSION['agent']; }
if (isset($_POST['agent'])) { $agent=$_POST['agent']; $_SESSION['agent'] = $agent;}
//then replace this line:
if (isset($_POST['agent']) && $_POST['agent'] == $agentv)) {
//with:
if ($agent==$agentv) {...
foreach ($agent as $agentv=>$agentn) {
$selected = (isset($_POST['agent']) && $_POST['agent'] == $agentv)?' selected':'';
echo "<option value=\"$agentv\"$selected>$agentn</option>";
}
?>
</select></p-->
<input type="hidden" name="agent" value="<?php echo $_POST['agent']; ?>">
<p><label>* Agent:</label><?php echo $_POST['agent']; ?>
<select name="agent">
<option value="<?php echo $_POST['agent']; ?>"><?php echo $_POST['agentn']; ?></option>
<option value="JV">Joanne</option>
<option value="DD">Debbie</option>
<option value="HS">House</option>
</select></p>
Bookmarks