Doug Molineux
Doug Molineux

Reputation: 12431

Iframe changing according to javascript and php

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

Upvotes: 1

Views: 522

Answers (1)

Josh
Josh

Reputation: 11070

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.

Upvotes: 1

Related Questions