943,743 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 831
  • PHP RSS
Apr 11th, 2008
0

listbox prob........

Expand Post »
PHP Syntax (Toggle Plain Text)
  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.
Reputation Points: 19
Solved Threads: 5
Junior Poster
lydia21 is offline Offline
183 posts
since Nov 2007
Apr 11th, 2008
0

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

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.
Reputation Points: 12
Solved Threads: 19
Posting Pro
techniner is offline Offline
521 posts
since May 2005
Apr 11th, 2008
0

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

ok.send sample code.thanks.
Reputation Points: 19
Solved Threads: 5
Junior Poster
lydia21 is offline Offline
183 posts
since Nov 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: shopping cart in php
Next Thread in PHP Forum Timeline: need help!!





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC