Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #13908
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: html php form second drop down select dependant list to keep selected value |
| Date | 2014-06-19 16:45 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <lnvi64$rtb$1@dont-email.me> (permalink) |
| References | <37222863-7713-4549-882a-ede165dc1c80@googlegroups.com> <lnv5dg$mn7$1@dont-email.me> <f96c0de3-9853-455f-9e37-32e042ee8771@googlegroups.com> |
On 6/19/2014 1:22 PM, ba pa wrote:
> I was just looking at this... using session_start and $_SESSION array...
>
> Would it goes as:
> document.getElementById("MyDropDown").value = '<?php echo $_SESSION['MyStoredValue']; ?>'
>
> or
>
> jQuery('#MyDropDown').val('<?php echo $_SESSION['MyStoredValue']; ?>');
>
> thanks,
> Pascal
>
Pascal,
Pretty much. Just a couple of things to remember:
session_start() must be called before ANY output to the client. This
includes <!DOCTYPE...>, <HEAD...> and even blank space.
This must be done on EVERY page which uses $_SESSION values.
And, of course, you must store the value in the $_SESSION, also.
And you should check to see if the value is set before using it (i.e.
the first time through it may not be set); if not, you should supply a
default value.
As for whether your jQuery code will work or not - try a javascript
newsgroup. But the PHP code looks OK.
--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
html php form second drop down select dependant list to keep selected value ba pa <pppbbb10@gmail.com> - 2014-06-19 09:20 -0700
Re: html php form second drop down select dependant list to keep selected value Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-19 13:08 -0400
Re: html php form second drop down select dependant list to keep selected value ba pa <pppbbb10@gmail.com> - 2014-06-19 10:22 -0700
Re: html php form second drop down select dependant list to keep selected value Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-19 16:45 -0400
Re: html php form second drop down select dependant list to keep selected value ba pa <pppbbb10@gmail.com> - 2014-06-19 14:40 -0700
csiph-web