Skip navigation links

MySQL Forums :: PHP :: Passing dropdown list value to another SELECT statement on same page


Advanced Search

Re: Passing dropdown list value to another SELECT statement on same page
Posted by: Peter Brawley ()
Date: August 03, 2012 08:22AM

Supposing there are two tables, parent (PK pid, ...) and child (PK cid, FK pid, ...), then at the top you have something like ...

if( isset( $_GET['pid'] )) { 
  $pid = $_GET['pid']; 
  if( $pid != $_SESSION['pid'] ) unset( $_SESSION['cid'] ); 
  $_SESSION['pid'] = $pid; 
} 
elseif( isset( $_SESSION['pid'] )) { 
  $pid = $_SESSION['pid']; 
} 
if( isset( $_GET['cid'] )) { 
  $cid = $_GET['cid']; 
  $_SESSION['cid'] = $cid; 
} 
elseif( isset( $_SESSION['table'] )) { 
  $table = $_SESSION['table']; 
}

Then further down, the query for child rows matching the pid selected by the user in the parent dropdown is...

select ... from child where pid=$pid;

Options: ReplyQuote


Subject Written By Posted
Passing dropdown list value to another SELECT statement on same page Jack Berberette 08/01/2012 07:20AM
Re: Passing dropdown list value to another SELECT statement on same page Peter Brawley 08/01/2012 10:25AM
Re: Passing dropdown list value to another SELECT statement on same page Jack Berberette 08/01/2012 02:19PM
Re: Passing dropdown list value to another SELECT statement on same page Peter Brawley 08/02/2012 02:38PM
Re: Passing dropdown list value to another SELECT statement on same page Jack Berberette 08/03/2012 06:15AM
Re: Passing dropdown list value to another SELECT statement on same page Peter Brawley 08/03/2012 08:22AM
Re: Passing dropdown list value to another SELECT statement on same page Jack Berberette 08/03/2012 08:34AM
Re: Passing dropdown list value to another SELECT statement on same page Jack Berberette 08/03/2012 08:42AM
Re: Passing dropdown list value to another SELECT statement on same page laptop alias 08/03/2012 05:18PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.