Jump to content

Recommended Posts

I'm not asking if PHP can replace onchange, I just want to know why this won't submit or if it will even work with sending values to PHP.

 

<form name="sort" method="post" action="<?php $_SERVER['PHP_SELF'] ?>">
            <select name="dselect" onchange="document.sort.sort()">
            	<?php while($row=mysql_fetch_assoc($department)) { echo "<option value='$row[dcode]'>$row[dcode]</option>"; } ?>
            </select>
            <noscript><input type="submit" name="sort" value="Sort" /></noscript><br />
        	<select name="course_name" size="7" style="width: 500px">
			<?php 
					if($sort) {
						while($c = mysql_fetch_object($run_get_course)) {
						echo "<option>$c->dcode$c->number - $c->title </option>";
						}
					} else {
						echo "<option>Please select a department to sort the courses</option>";
					  }
			?>
            </select>
            </form>

 

 

I want the first select "dselect" which selects a department to populate the second select list with the courses within that department. I have a feeling that the onchange is not working because I don't see the browser refreshing at all. What can be done here? Is it just a naming issue?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.