please help me in drop down list

Reply

Join Date: May 2008
Posts: 28
Reputation: almualim is an unknown quantity at this point 
Solved Threads: 0
almualim almualim is offline Offline
Light Poster

Re: please help me in drop down list

 
0
  #11
May 8th, 2008
hi, ok i tried to print this value: $firstdropdownlistvalue = $_POST['col_name'];
by echo($firstdropdownlistvalue);
but it's doesn't appeared in the browser. why?
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,760
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 332
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: please help me in drop down list

 
0
  #12
May 8th, 2008
Post your latest code.
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 28
Reputation: almualim is an unknown quantity at this point 
Solved Threads: 0
almualim almualim is offline Offline
Light Poster

Re: please help me in drop down list

 
0
  #13
May 8th, 2008
okay:

  1. <?php
  2. mysql_connect ("localhost","root","");
  3. mysql_select_db ("University");
  4.  
  5. $firstdropdownlistvalue = $_POST['col_name'];
  6.  
  7. $get_list_result = mysql_query("select Col_Name from College");
  8.  
  9. echo '<form name="delete" method="POST" action="delete_dept2.php">';
  10.  
  11. echo'<select name=col_name onchange=javascript: document.delete.submit(); style="position:absolute;left:311px;top:146px;width:303px;z-index:2">';
  12. while ($recs = mysql_fetch_array($get_list_result)){
  13.  
  14. $display_list = $recs['Col_Name'];
  15. if($display_list==$firstdropdownlistvalue){
  16. $selected = "selected";
  17. }
  18. else
  19. { $selected = "";
  20. }
  21. echo "<option value='".$display_list."' $selected>" .$display_list."</option>";
  22. }
  23. echo "</select>";
  24. echo ($firstdropdownlistvalue);
  25.  
  26. $get_list_result2 = mysql_query("select * from College where Col_Name='$firstdropdownlistvalue'");
  27. $get_list_result3= mysql_query("select D_Name from Department where Col_No='$get_list_result2'");
  28.  
  29. echo'<select name="formselect2" style="position:absolute;left:310px;top:223px;width:308px;z-index:4">';
  30. while ($recs2 = mysql_fetch_array($get_list_result3)){
  31.  
  32. $display_list2 = $recs2['D_Name'];
  33.  
  34. echo "<option value='".$display_list2."'> $display_list2 </option>";
  35. }
  36. echo '</select>';
  37. ?>
Last edited by peter_budo; May 11th, 2008 at 11:19 am. Reason: Keep It Organized - please use [code] tags
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,760
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 332
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: please help me in drop down list

 
0
  #14
May 8th, 2008
onchange="javascript: document.delete.submit();" instead of
onchange=javascript: document.delete.submit();

Secondly,
$get_list_result2 = mysql_query("select * from College where Col_Name='$firstdropdownlistvalue'");
$get_list_result3= mysql_query("select D_Name from Department where Col_No='$get_list_result2'");
is wrong. What are you trying to do ?
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 28
Reputation: almualim is an unknown quantity at this point 
Solved Threads: 0
almualim almualim is offline Offline
Light Poster

Re: please help me in drop down list

 
0
  #15
May 8th, 2008
see the last update on the code:

  1. <?php
  2. mysql_connect ("localhost","root","");
  3. mysql_select_db ("University");
  4.  
  5. $firstdropdownlistvalue = $_POST['col_name'];
  6.  
  7. $get_list_result = mysql_query("select Col_Name from College");
  8.  
  9. echo '<form name="delete" method="POST" action="delete_dept2.php">';
  10.  
  11. echo'<select name=col_name onchange="javascript: document.delete.submit();" style="position:absolute;left:311px;top:146px;width:303px;z-index:2">';
  12. while ($recs = mysql_fetch_array($get_list_result)){
  13.  
  14. $display_list = $recs['Col_Name'];
  15. if($display_list==$firstdropdownlistvalue){
  16. $selected = "selected";
  17. }
  18. else
  19. { $selected = "";
  20. }
  21. echo "<option value='".$display_list."' $selected>" .$display_list."</option>";
  22. }
  23. echo "</select>";
  24. echo ($firstdropdownlistvalue);
  25.  
  26. $get_list_result2 = mysql_query("select col_No from College where Col_Name='$firstdropdownlistvalue'");
  27. while ($recs2 = mysql_fetch_array($get_list_result2)){
  28.  
  29. $display_list2 = $recs2['col_No'];
  30. }
  31.  
  32.  
  33.  
  34. $get_list_result3= mysql_query("select D_Name from Department where Col_No='$$display_list2'");
  35.  
  36. echo'<select name="formselect2" style="position:absolute;left:310px;top:223px;width:308px;z-index:4">';
  37. while ($recs3 = mysql_fetch_array($get_list_result3)){
  38.  
  39. $display_list3 = $recs3['D_Name'];
  40.  
  41. echo "<option value='".$display_list3."'> $display_list3 </option>";
  42. }
  43. echo '</select>';
  44. ?>


  1. $get_list_result2 = mysql_query("select col_No from College where Col_Name='$firstdropdownlistvalue'");

here i want to get college_no(col_No) from college table, if the college name(col_Name) equals the value came from 1st dropdown list($firstdropdownlistvalue)

$get_list_result3= mysql_query("select D_Name from Department where col_No='$display_list2'");

and here i want to get department name(D_Name) from Department table, if college_no(col_No) equals $display_list2
Last edited by peter_budo; May 11th, 2008 at 11:20 am. Reason: Keep It Organized - please use [code] tags
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,760
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 332
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: please help me in drop down list

 
0
  #16
May 8th, 2008
Then use a sub query.
  1. $query = "select D_Name from Department where col_No = (select col_No from College where col_name = '$firstdropdownlistvalue')";
This will return the D_name of the selected col_name.
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 28
Reputation: almualim is an unknown quantity at this point 
Solved Threads: 0
almualim almualim is offline Offline
Light Poster

Re: please help me in drop down list

 
0
  #17
May 8th, 2008
Tired with me, but the problem still exist and I do not know what to do...
Last edited by almualim; May 8th, 2008 at 9:37 am.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,760
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 332
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: please help me in drop down list

 
0
  #18
May 8th, 2008
Use firefox to execute your scripts. Make use of error console to see any javascript error.
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 28
Reputation: almualim is an unknown quantity at this point 
Solved Threads: 0
almualim almualim is offline Offline
Light Poster

Re: please help me in drop down list

 
0
  #19
May 8th, 2008
i tried with firefox, but when i was select value from 1st dropdown list Transmission occurs for the second page, but i want the values appear in the same page.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,760
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 332
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: please help me in drop down list

 
0
  #20
May 8th, 2008
What second page ? Why dont you keep everything in the same page ?
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



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

©2003 - 2009 DaniWeb® LLC