Re: Notification of listbox selection change

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Larry:

You don't replace the entire page -- you fill-in the portion needed.

What you are missing here is DOM scripting.

The Ajax portion sends a GET request to a php script (get.php) that does all the db heavy work which in turn repopulates a "myspan" div, like so:

(index.php)

<div id="myspan">	<!-- start of myspan -->
	<?php include("get.php"); ?>
</div>			<!-- end of myspan -->

The get.php script has all the database stuff including the $_GET[] that brings in the state, city, and zip values.

Based upon what is provided, get.php script pulls the data from the db and populates the select controls with what is needed.

There is no refresh of the index page, but rather just an update of the "myspan" div via get.php.

HTH's

tedd

_______________
tedd sperling
tedd@xxxxxxxxxxxx





On Jan 8, 2014, at 5:17 PM, Larry Martell <larry.martell@xxxxxxxxx> wrote:

> On Sat, Dec 14, 2013 at 7:00 AM, Tedd Sperling <tedd@xxxxxxxxxxxx> wrote:
>> On Dec 9, 2013, at 3:40 PM, Larry Martell <larry.martell@xxxxxxxxx> wrote:
>> 
>>> Is there any way in php to have a function be called when the value of
>>> a listbox selection changes?
>> 
>> Larry:
>> 
>> Sure, take a look at this:
>> 
>> http://php1.net/a/zipcode-states/
>> 
>> Everything except the database is there -- you as you may.
> 
> Tedd-
> 
> Thanks very much for this. I just got around to trying it, and I
> adapted it for my needs and it's basically working. The one issue I
> have is that my request returns a complete new page and I want to
> replace the existing page with that. The problem is that the request
> originates from a frame and when I try and replace the page with the
> response the new page get rendered within the frame. Do you know how
> to replace the entire page with the response?
> 
> I've tried:
> 
> document.open();
> document.write(response);
> document.close();
> 
> and:
> 
> var newDoc = document.open("text/html", "replace");
> newDoc.write(response);
> newDoc.close();
> 
> But I got the same undesirable results from both.
> 
> I realized this is not really a PHP question, but I wanted to continue
> this thread here as others could benefit from it.
> 
> Thanks!
> -larry
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


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






[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux