| 
	
 | 
 Posted by IchBin on 07/14/06 23:11 
I am cross posting to comp.lang.php and alt.comp.lang.php. 
 
I am having a problem with getting a post from a dropdownlist off a html  
form. While debugging, by instruction steps, for some reason I am never  
get passed the isset($_POST['author_pk']) after selecting an item in the  
dropdownlist. 
 
I have coded a simple script to duplicate what I am trying to do, just  
to make sure i understand it, and that works. This is the code and has  
to be something simple.. 
 
<?php 
// 
// Debugging 
$debug = false; 
 
// 
// Open DB 
include 'library/opendb.php'; 
 
// This form uses the POST method, so process any post selections here 
if( isset($_POST['author_pk']) ) { 
   echo 'Ok I have an author Primary Key'; 
  // do whatever you need to do with the author_pk 
//     $sqlcmd = $author_detail_select . {$_POST['author_pk']}; 
//     $author_detail = mysql_query($sqlcmd); 
} 
// 
// main form query 
if ($debug){ 
     $sqlcmd = $author_dropdown_select . ' ' . limit(); 
     echo $sqlcmd; 
  } else { 
       $sqlcmd = $author_dropdown_select; 
} 
$result =  mysql_query($sqlcmd); 
if (!$result) { 
    die('Database Error: ' . mysql_error()); 
    exit; 
} 
// 
// Close DB 
include 'library/closedb.php'; 
?> 
/* 
Can't use 'PHP_SELF' under PHP Designer. Works running off server. 
<FORM NAME="author" method="post" action="<?php echo  
$_SERVER['PHP_SELF'];?>"> 
*/ 
<FORM NAME="author" method="post" action="PeopleQuotes.php"> 
<SELECT NAME="author_pk" SIZE="20" COLS="20"> 
 
<?php 
// a loop to populate the select options 
while( $row = mysql_fetch_object($result) ) { 
     printf("<option value=\"%d\">%s %s, %s %s %s</option>\n", 
         $row->id, $row->TITLE, $row->lastname, 
         $row->firstname, $row->middlename, $row->SUFFIX); 
} 
 
mysql_free_result($result); 
 
// display any author details based on the user's selection 
if( isset($author_detail) ) { 
//     while( $row = mysql_fetch_assoc($author_detail) ) { 
//        printf("Title: %s<br>\n", $row['title']); 
      } 
} 
?> 
</SELECT> 
</FORM> 
 
Thanks in Advance... 
IchBin, Pocono Lake, Pa, USA              http://weconsultants.phpnet.us 
__________________________________________________________________________ 
 
'If there is one, Knowledge is the "Fountain of Youth"' 
-William E. Taylor,  Regular Guy (1952-)
 
  
Navigation:
[Reply to this message] 
 |