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
.
精彩评论