php-windows Digest 10 Apr 2006 10:44:13 -0000 Issue 2933

Topics (messages 26825 through 26828):

Re: Select list again
        26825 by: Alf Stockton
        26826 by: Alf Stockton

Re: Select list again.
        26827 by: Alf Stockton
        26828 by: Alf Stockton

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
George Pitcher wrote:
Alf,

I didn't quite understand your question, but if you 'Submit' your form then
in your response script do

print_r($_POST);

That will show you how the data is being received and you should be able to
work out how to capture what you need.

Hope this helps

George



-----Original Message-----
From: Alf Stockton [mailto:[EMAIL PROTECTED]
Sent: 7 April 2006 11:35 am
To: php windows
Subject: [PHP-WIN] Select list again


How can I, with only HTML & PHP, retrieve the select value from a
selection the user made without a select button?

I was not sure that I understood the question so let me try and reword it. and now that I try and rethink the question I realise that I want a client size solution using software that works server side. Sorry for wasting your time. I need to look at javascript and get it to tell me which item on that list the user selected, without having the form submitted to the server.
I apologise again.


--
Regards,
Alf Stockton            www.stockton.co.za

Give thought to your reputation.  Consider changing name and moving to
a new town.

My email disclaimer is available at www.stockton.co.za/disclaimer.html

--- End Message ---
--- Begin Message ---
George Pitcher wrote:
Alf,

I suspect that you're still toil;ing away with the same problem that we
played with last week?

I moved to Ajax because the previous (non-Ajax) javascript solution seemed
to be a bit flakey.

One of the reasons why I never passed that earlier one on to you was that it
required fixed length values. ie all your PromotionIDs needed to be the same
length and DrawIDs needed to be the same length, so you need to have control
over how those IDs are set, and also be sure that you will never run out of
IDs.

Maybe I am just a slow learner but now I have:-

<SCRIPT LANGUAGE="JavaScript">
function GetValue() {
        alert(TicketStatus.Promotion_id.value)
}</SCRIPT>

doing some of what I want, it displays the correct information when changing selection, which is fine. Now I need to put that value into a PHP variable for the next step in the scenario.

--
Regards,
Alf Stockton            www.stockton.co.za

You have an unusual equipment for success.  Be sure to use it properly.

My email disclaimer is available at www.stockton.co.za/disclaimer.html

--- End Message ---
--- Begin Message --- I don't believe that it has taken this long for me to understand that both the client as well as the server software/script exist in one document/script/source file.

It was a hell of a lot easier when writing client / server stuff in C where it was obvious what the client software was and what the server software was and what they both had to do.

Now I have been beating my head against a brick wall where in fact I now believe that the solution is more simple.

On the server build select list one in PHP and also build an array containing anything that might be applicable for list two. Script now transfers to the client machine, via HTML, where the user selects what they want from list one and some javascript extracts from the array built for list two, mentioned above, what is needed for the second select list.

Does any of the above make any sense?

One part of the above I don't as yet know how to handle is accessing a PHP built array from javascript but I am sure that I will find it...:-)

--
Regards,
Alf Stockton            www.stockton.co.za

Beware of Bigfoot!

My email disclaimer is available at www.stockton.co.za/disclaimer.html

--- End Message ---
--- Begin Message ---
Dale D. Attree wrote:
Build a php string instead of an array and allocate the string to a form
hidden field and then access the hidden field via JavaScript.

Thanks for the suggestion.
What I have done is in my PHP
print "<input type='hidden' name='DrawString' value=$Message>";
and I have viewed the page source and a hidden field called DrawString contains the correct data.
Now I don't seem to be able to get it in my javascript and I have tried
        alert (document.TicketStatus.DrawString.value)
        alert (TicketStatus.DrawString.value)
        alert (DrawString.value)
as well as
        alert (DrawString)
the form is called TicketStatus and the javascript is called via
<select name='Promotion_id' id='Promotion' onchange='GetValue()'>

Please make some suggestions on what I may have done wrong.

--
Regards,
Alf Stockton            www.stockton.co.za

If more of us valued food and cheer and song above hoarded gold, it would
be a merrier world.
                -- J.R.R. Tolkien

My email disclaimer is available at www.stockton.co.za/disclaimer.html

--- End Message ---

Reply via email to