开发者

Iframe changing according to javascript and php

开发者 https://www.devze.com 2022-12-25 00:15 出处:网络
I\'m attempting to reload an iframe when a onChange event occurs heres what i got in javascript tags in the header

I'm attempting to reload an iframe when a onChange event occurs

heres what i got in javascript tags in the header


`

function getSchedule(oEvent) { var n = document.getElementById("wantedTherapist"); var newn = n.options[n.selectedIndex].value; window.frames['schedule'].src = "schedule.php?therapist="+newn; }

`

and then my iframe tag


iframe id="schedule" name="schedule" src="schedule.php"></iframe>

and finally my select box


<select id="wantedTherapist" name="wantedTherapist" onchange="getSchedule(Event)">
开发者_开发技巧?php
            $query = "SELECT
                    therapistTable.*
                    FROM
                    therapistTable
                    WHERE
                    therapistTable.activated = 'true'
                    ";
            $result = mysql_query($query) or die (mysql_error());
            while($array = mysql_fetch_assoc($result))
            {
            extract($array);
            echo "<option value=\"$username\">$username - $city</option>";
            }
?
</select>

i took the arrows off php tags and the first arrow off iframe so that it would show in question. Its loading the schedule.php in the iframe but not sending it the variable, what am i doing wrong?? thank you for any advice ahead of time


What is the URL of the iFrame being set to? You can confirm this (in Firefox) by right clicking in the iFrame and selecting "Open Frame in New Window"

If the URL is schedule.php?therapist=, then the error is with the code you've posted here. If the URL contains a value for therapist, for example, schedule.php?therapist=bob, then the error is in schedule.php.

0

精彩评论

暂无评论...
验证码 换一张
取 消