> I've managed to get Windows IE to pick up on most of my $_SESSION
variables
> once a user clicks the 'Back' button using the following code in the base
> form:
>
> 'value=<?php if(!empty($_SESSION['rfname'])) echo $_SESSION['rfname']; ?>'
>
> However, when I try this approach for a muliple SELECT dropdown box that
is
> loaded by a 'require' statement, it doesn't pass the info. I've tried to
> isolate the individual components:
>
> <?php require("dobdod.fdd");
>
> if(!empty($_PST['bday'])) echo $_POST['bday'];
> if(!empty($_POST['bmonth'])) echo $_POST['bmonth'];
> if(!empty($_POST['birth'])) echo $_POST['birth'];
>
> if(!empty($_POST['dday'])) echo $_POST['dday'];
> if(!empty($_POST['dmonth'])) echo $_POST['dmonth'];
> if(!empty($_POST['death'])) echo $_POST['death'];
> ?>
>
> Btw, the base form calls another form, which displays an error message.
Once
> the 'Back' button is clicked, the base form reappears. [I've also tried
> putting a <?php . . . ?> around each if(!empty . . .); statement above
with
> same result.]
>
> Any ideas what I'm doing wrong? I've been at this one for a couple of
weeks,
> and nothing seems top work. Is it possible to pass the info back to the
base
> form?

SELECT boxes work differently from text boxes. To set a select box to a
certain value, you need to put SELECTED into the option tag, like:

<option value="some_value" SELECTED>Text Value</option>

So, you need to create some loop or test to see where you should put the
SELECTED. For short lists, doing something like:

<option value="some_value" <? if(isset($_SESSION['select']) &&
$_SESSION['select'] == 'some_value') { echo " SELECTED"; }?>>Text
Value</option>

For larger lists, it's easier to put the values into an array and make a
function that loops through and test each value for where to put the
SELECTED text.

Hope that helps.

---John Holmes...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to