listbox prob........

Thread Solved

Join Date: Nov 2007
Posts: 183
Reputation: lydia21 is an unknown quantity at this point 
Solved Threads: 5
lydia21 lydia21 is offline Offline
Junior Poster

listbox prob........

 
0
  #1
Apr 11th, 2008
  1. <html>
  2. <head>
  3. <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT">
  4. <!--
  5. function view(ss)
  6. {
  7. if(ss.options[ss.selectedIndex].value!='')
  8. {
  9. var a=document.getElementById('IndustryType');
  10. var temp=a.value;
  11. var b='<?php echo $id; ?>';
  12. parent.frameright.location = "http://www.web.com/webd.php?var=" + temp + "&vars=" + b;
  13. }
  14. }
  15. -->
  16. </script>
  17. </head>
  18. <body>
  19. $id=$_GET('id');
  20. $hostname = "localhost";
  21. $username = "car";
  22. $password = "try";
  23. $dbid = "car";
  24. $link=mysql_connect($hostname, $username, $password);
  25. mysql_select_db($dbid) or die("unable to connect");
  26. $result=mysql_query("select * from jop where owns='$id' and chkshare='yes'");
  27. $sel ='<tr><td align="center" bgcolor="#EBEBEB"><select name="IndustryType" language="javascript" onchange="view(this);" size="12" style="width: 300px">';
  28. $i = 0;
  29. while ($row = mysql_fetch_row($result)) {
  30. if ($i == 0) {
  31. $value = 'SELECTED value="' . $row[0] . '"';
  32.  
  33. }
  34. else {
  35. $value = 'value="' . $row[0] . '"';
  36. }
  37. $sel .= '<option ' . $value . '>' . $row[1] . '</option>';
  38. $i++;
  39. }
  40. $sel .= '</select></td></tr>';
  41. print $sel;
  42. ?>
  43. </form>
  44. </body>
  45. </html>
i'm having two frames.above code is first frame code.in this code i'm getting list box first value default selected.So in the second frame i need the corresponding value should come....i 'm getting output....my problem is first value alone not getting because of onchange....default i need my second frame also should load dynamically.
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 508
Reputation: techniner is an unknown quantity at this point 
Solved Threads: 19
techniner techniner is offline Offline
Posting Pro

Re: listbox prob........

 
0
  #2
Apr 11th, 2008
Well your main problem here is trying to use javascript + php natively like this with frames.

I would look to convert this to ajax as it is much more flexible. Sort of middle ground for client vs. server side.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 183
Reputation: lydia21 is an unknown quantity at this point 
Solved Threads: 5
lydia21 lydia21 is offline Offline
Junior Poster

Re: listbox prob........

 
0
  #3
Apr 11th, 2008
ok.send sample code.thanks.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC