http://www.dynamicdrive.com/dynamici...jaxcontent.htm
I am using AJAX and PHP 5. My page is using a dynamically-created drop-down menu to show a list of items in a MySQL table, which I am using the above AJAX script to display additional content in a DIV depending on the selection made.
The problem is, the external file has an additional PHP codeblock that requests data from a different MySQL table based on the selection from the drop-down. Previously, I've used javascript to reload the page with GET parameters to display this new content, but I'm wanting to avoid page refreshes. So what I need is a means in AJAX to pass a parameter to an external page so the PHP within that page can execute correctly and the content display.
For illustration:
This is the form with the drop-down list, which will update the content of the "toons" DIV with the content from server.php. Note that I am trying to pass a GET parameter of s, which would be the servername from the MySQL table.Code:<div id="toons"></div> <div id="main"></div> <div class="headerbox"> <br />Header Text Here </div> <div class="menubox"> <form> <select id="ajaxmenu" size="1" onChange="ajaxcombo('ajaxmenu', 'toons'); loadobjs('test.css')"> <option value="">Choose Server</option> <?php $a=0; while($a < $totalRows_Recordset1) { printf("<option value=\"server.php?s='%s'\">%s</option>", $Recordset1[$a]['servername'], $Recordset1[$a]['servername']); $a++; } ?> </select> </form>
Here is where my problem lies. Server.php has a MySQL SELECT statement in it that is based upon the servername passed from the drop-down above.
Any suggestions/scripts that would help here? Should I go with an Iframe instead?
Thanks in advance,
Shot



Reply With Quote
Bookmarks