LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 04-16-2004, 10:01 PM   #1
Gerardoj
Member
 
Registered: May 2003
Location: Somewhere over the Rainbow
Distribution: Slackware 9.x, Knoppix, Damn Small Linux, RedHat.
Posts: 465

Rep: Reputation: 30
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>

Last edited by Gerardoj; 04-16-2004 at 10:43 PM.
 
Old 04-16-2004, 11:29 PM   #2
irish_rover
Member
 
Registered: Sep 2002
Location: IN, USA
Distribution: Debian, Endian FW
Posts: 368

Rep: Reputation: 30
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.
 
Old 04-16-2004, 11:50 PM   #3
Gerardoj
Member
 
Registered: May 2003
Location: Somewhere over the Rainbow
Distribution: Slackware 9.x, Knoppix, Damn Small Linux, RedHat.
Posts: 465

Original Poster
Rep: Reputation: 30
Thanks for your suggestion, I found it on Google..
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
select on simple data type? Thinking Programming 1 08-20-2005 07:56 PM
Changing a table contents dynamically based on select box rose_bud4201 Programming 4 01-13-2005 10:48 AM
mysql - transfer data from one table to another?? macinslaw Programming 22 08-20-2004 01:29 PM
Data Recover Help -> Incorrect Partition Table PhuckFonix Linux - General 8 05-30-2004 10:12 PM
Extract data from disk, without partition table... mandatory Linux - General 1 10-20-2003 06:35 AM


All times are GMT -5. The time now is 10:01 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration