LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   SELECT data from Table (https://www.linuxquestions.org/questions/programming-9/select-data-from-table-171156/)

Gerardoj 04-16-2004 10:01 PM

SELECT data from Table
 
Im retrieving data on DropDown menu as below way. But I would like that when someone select some option on the Drop menu then show all the data that corresponse to the selected option, and display results as a list or table.. How can do that? Thanks lot..


PHP Code:

<FORM NAME="frmMenu" OnSubmit="jumptourl()">     
<SELECT NAME="SELECT" OnChange="frmMenu.submit()"> 

<?php 
$link 
OpenConnection(); 
  
$result mysql_query("SELECT * FROM Campeonatos ORDER BY 'sort' ASC"); 

  while(
$row mysql_fetch_array($result)) 
  { 
    
/* display menu items  */ 
    
echo '<OPTION VALUE="' $row[campeonato] . '">' $row[campeonato] . "</OPTION>"
  } 

CloseConnection($link); 
?> 

</SELECT> 
</FORM> 

<SCRIPT LANGUAGE="JavaScript"> 
  function jumptourl() 
  { 
    window.location = './index.php?m=' + frmMenu.SELECT + '&s=0'; 
  } 
</SCRIPT>


irish_rover 04-16-2004 11:29 PM

You need to use a combination of PHP and Javascript. Use the php to generate the javascript array. You should be able to google for this idea and find some good advice.

Gerardoj 04-16-2004 11:50 PM

Thanks for your suggestion, I found it on Google..


All times are GMT -5. The time now is 09:39 PM.