Hi frnds..

i want to daisplay values in listbox from database table regarding selected item in first listbox?

here i copied the code...in this i got values of first listbox frm db table..after i want 2nd listbox values from db table of 1st selected item..

plz help ma asap...
i am eagarly waiting 4 reply..

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<table width="100%" height="208" border="0">
  <tr>
    <th width="87%" height="21" scope="col">
      <div align="right">
        <table width="60%" border="0">
          <tr>
            <th width="34%" scope="col"><div align="right"><a href="addcourses.php">Add Courses</a></div></th>
            <th width="40%" scope="col"><div align="right"><a href="addsubcourses.php">Add Sub Courses</a></div></th>
            <th width="26%" scope="col"><div align="right">Add Content</div></th>
          </tr>
            </table>
    </div></th>
    <th width="13%" scope="col"><a href="logout.php">Logout</a></th>
  </tr>
  <tr>
    <td>
    <form name="form" method="post" action="content.php">
    <table width="100%" height="118" border="0">
      <tr>
        <td><div align="right"><strong>Course</strong></div></td>
        <td><div align="center"><strong>:</strong></div></td>
        <td><select name="cname" id="select" >
		<?php 
include("config.php");
$ress=mysql_query("select cname from addcourse ") or die(mysql_error());


while ($row = mysql_fetch_array($ress))	 { 
        
	?>
        <option value="<?php echo $row['cname'];  ?> " > <?php echo $row['cname']; ?></option>
        <?php
		}
		?>
        
        </select></td>
      </tr>
      <tr>
        <th width="57%" scope="col"><div align="right">Sub Course </div></th>
        <th width="8%" scope="col">:</th>
        <th width="35%" scope="col" align="left">
		[B]<select name="subcname" id="">
        
		<?php 
include("config.php");
$result=mysql_query("select subcname from subcourse  ") or die(mysql_error());


while ($row = mysql_fetch_array($result))	 { 
        
	?>
        <option value="<?php echo $row['subcname'];  ?> " > <?php echo $row['subcname']; ?></option>
        <?php
		}
		?>[/B]
        
        </select></th>
      </tr>
      
      <tr>
        <td><div align="right"><strong>Content</strong></div></td>
        <td><div align="center"><strong>:</strong></div></td>
        <td><textarea name="content" id="textfield2" rows="5" cols="30"></textarea></td>
      </tr>
      <tr>
        <td>
          <div align="right">
            <input type="submit" name="button" id="button" value="Add Content" />
            </div></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      
    </table>
    </form>
    
    </td>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>

Thanks in advance...

Okay, I did NOT test this, so who knows if it will actually work or what bugs, spelling, and syntax errors I have in it ... but this is the idea I would go with and you can check the errors to figure out what I did wrong. :-)

Hope it helps ...

content.php

<?php

include_once( "config.php" );

$doc = new DOMDocuemt('1.0');
$doc->loadHTMLFile('form.html');
$nodes = $doc->getElementsByTagName('*');
foreach ( $nodes as $node ) {
  switch ( $node->getAttribute('id') ) {
    case 'select': $select = $node; break;
    case 'select2': $select2 = $node; break;
  }
}

$result = mysql_query("SELECT `cname` FEOM `addcourse`") 
  or die(mysql_error());
if ( mysql_num_rows( $result ) ) {
  while ( $obj = mysql_fetch_object( $result ) ) {
    $option = $doc->createElement('option');
    $option->setAttribute('value',"obj->cname");
    $option->nodeValue = $obj->cname;
    $select->appendChild( $option );
  }
  mysql_free_result( $result );
} else {
  die( "No results for first select box query" );
}

if ( $cname = $_REQUEST['cname'] ) {
  $result = mysql_query("SELECT `subcname` FEOM `subcourse` WHERE `cname`='$cname'") 
  or die(mysql_error());
  // WHERE `cname`='$cname' ... here `cname` must match field searched specific to your `subcourse` database table
  if ( mysql_num_rows( $result ) ) {
    while ( $obj = mysql_fetch_object( $result ) ) { 
      $option = $doc->createElement('option');
      $option->setAttribute('value',"obj->subcname");
      $option->nodeValue = $obj->subcname;
      $select2->appendChild( $option );
    }
  } else {
    die( "No results for second select box query" );
  }
}

print $doc->saveHTML();
?>

form.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>Untitled Document</title>
</head>
<body>
<table width="100%" height="208" border="0">
  <tr>
    <th width="87%" height="21" scope="col"> <div align="right">
        <table width="60%" border="0">
          <tr>
            <th width="34%" scope="col"><div align="right"><a href="addcourses.php">Add Courses</a></div></th>
            <th width="40%" scope="col"><div align="right"><a href="addsubcourses.php">Add Sub Courses</a></div></th>
            <th width="26%" scope="col"><div align="right">Add Content</div></th>
          </tr>
        </table>
      </div></th>
    <th width="13%" scope="col"><a href="logout.php">Logout</a></th>
  </tr>
  <tr>
    <td><form name="form" method="post" action="content.php">
        <table width="100%" height="118" border="0">
          <tr>
            <td><div align="right"><strong>Course</strong></div></td>
            <td><div align="center"><strong>:</strong></div></td>
            <td><select name="cname" id="select"></select></td>
          </tr>
          <tr>
            <th width="57%" scope="col"><div align="right">Sub Course </div></th>
            <th width="8%" scope="col">:</th>
            <th width="35%" scope="col" align="left"> <select name="subcname" id="select2"></select></th>
          </tr>
          <tr>
            <td><div align="right"><strong>Content</strong></div></td>
            <td><div align="center"><strong>:</strong></div></td>
            <td><textarea name="content" id="textfield2" rows="5" cols="30"></textarea></td>
          </tr>
          <tr>
            <td><div align="right"><input type="submit" name="button" id="button" value="Add Content" /></div></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
        </table>
      </form></td>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>

hi,create a new field parentid in ur table and insert values like this

<?  $qry2="INSERT INTO fm_forums(title,description,parentid) VALUES ('".$_POST['title']."','".$_POST['description']."','".$_POST['selcategory']."')";
			 $res2=mysql_query($qry2) or die(mysql_error());?>
<table width="85%"  border="0" align="center" cellpadding="6" cellspacing="1" bgcolor="#CCCCCC">
			
                <tr bgcolor="#E1E1E1">
                  <td width="25%" bgcolor="#FFFFFF"><strong>Sub-Topic Title : </strong></td>
                  <td width="75%" bgcolor="#FFFFFF"><input name="title" type="text" class="Inputform" id="title2" size="60" <? if (isset($_GET['aid'])){?>value="<?=$subcategory?>"><? }?></td>
                </tr><?
				    $ers="SELECT * FROM fm_forums WHERE parentid=0";
					$sed=mysql_query($ers) or die(mysql_error());
					$sed1=mysql_fetch_array($sed);
					$qry4="SELECT * FROM fm_forums WHERE parentid=".$sed1['forumid'];
					$res4=mysql_query($qry4) or die(mysql_error());
					$num4=mysql_num_rows($res4);
					if($num4>0)
					{
					
					?>
                <tr bgcolor="#E1E1E1">
                  <td bgcolor="#FFFFFF"><strong>Under Topic : </strong></td>
                  <td bgcolor="#FFFFFF">
				  
                    <select name="selcategory" class="box2" id="selcategory">
                      <option value="">------Selectsubtopic-------</option>
                    <?  while($row4=mysql_fetch_array($res4))
					{ ?>
                      <option value="<?=$row4['forumid']?>" <? if ((isset($_GET['forumid']))&&($row4['forumid']==$category)){?>selected<? }?>>
                      <?=$row4['title']?><? }
				}?>
                      </option>
               
                    </select></td>
                </tr>
                <tr bgcolor="#E1E1E1">
                  <td bgcolor="#FFFFFF"><strong>Summary :</strong></td>
                  <td bgcolor="#FFFFFF"><textarea name="description" cols="60" rows="8" class="Inputform" id="description"><? if (isset($_GET['aid'])){ echo "$subcategory1";}?></textarea></td>
                </tr>
            </table>

in front end u will display based on id like this

<tr>
        <th width="57%" scope="col"><div align="right">Sub Course </div></th>
        <th width="8%" scope="col">:</th>
        <th width="35%" scope="col" align="left">
		<select name="subcname" id="">
        
		<?php 
include("config.php");
$result=mysql_query("select subcname from subcourse where parentid=".$row[id]) or die(mysql_error());


while ($row = mysql_fetch_array($result))	 { 
        
	?>
        <option value="<?php echo $row['subcname'];  ?> " > <?php echo $row['subcname']; ?></option>
        <?php
		}
		?>
        
        </select></th>
      </tr>

i hope u got what iam trying to say and dont worry about aid here i called it for editing
if any doubts post here

Thank u praveen,

It looks simple...but i didn,t get totally..i.e where i want to used that code.can u explain me plz...

In which page i will use that query 2?

thanks once again..

okay, create parentid field in same dbtable in which u have list values and create a new php page to insert dbvalues in second list box for that use my first code. in the page u posted use my second code to display ur second list box values from db.

Hi langsor..
Thank u verymuch...

here i got an error..
"Fatal error: Class 'DOMDocuemt' not found in C:\wamp\www\training\content.php on line 5 "


can u explain me please....

Thanks in advance

i dont knew but may be this attachment may work

Attachments
<?

/******************************************

Fichero:		/php/classes/Document.php
Fecha:			22-04-2004
Autor:			Korvus

Copyright (c) Vivace Multimedia
http://www.vivacemultimedia.com

******************************************/

define( "DOM_INSERT_FIRST", 0 );
define( "DOM_INSERT_LAST", 1 );
define( "DOM_INSERT_AFTER", 1 );
define( "DOM_INSERT_BEFORE", 0 );

class Document
{

	// ==================== Atributos ==========================

	var $_path;
	
	var $encoding			=			"ISO-8859-1";
	var $version			=			"1.0";
	
	var $firstChild;
	var $_elements			=			array();
	
	// ==================== Metodos SET ========================
	
	function Document( $sFile = NULL )
	{
	 if( is_null( $sFile ) || !file_exists( $sFile ) )
	  return( false );
	 
	 $this->_path = $sFile;
	 $this->parseFromString( file_get_contents( $this->getPath() ) );
	}	

	function parseFromString( $sString )
	{
	 $sSource = preg_replace( "/>\s+</i", "><", $sString );
	 $oLevels = array();
	 
	 $oParser = xml_parser_create( $this->encoding );
	 xml_parser_set_option( $oParser, XML_OPTION_CASE_FOLDING, 0 );
	 xml_parse_into_struct( $oParser, $sSource, $oElements );
	 xml_parser_free( $oParser );
	 
	 # Situa los nodos en orden jerarquico con arrays
	 # No conserva los tags de fin de elemento ( </fin> ) en el arbol de elementos
	 
	 for( $i = 0; $i < count( $oElements ); $i++ )
	 {
	  # Si el elemento es del tipo cdata, subimos 1 nivel para que sea asignado al padre
	  # correcto, y dejamos el tag a 'NULL' para que la funcion 'createElement' cree un 'cdata'
	  
	  if( $oElements[ $i ][ "type" ] == "cdata" )
	  {
	   $oElements[ $i ][ "level" ]++;
	   $oElements[ $i ][ "tag" ] = NULL;
	  }
	  
	  if( $oElements[ $i ][ "type" ] != "close" )
	  {
	   $nIndex = array_push( &$this->_elements, $this->createElement( $oElements[ $i ][ "tag" ], $oElements[ $i ][ "value" ] ) ) - 1;
	   
	   # Propiedades del nuevo elemento XML
	   # valor, atributos, nodo padre, posicion dentro de los nodos hijos, documento raiz ...
	   
	   $this->_elements[ $nIndex ]->_root = &$this;
	   $this->_elements[ $nIndex ]->attributes = ( array ) $oElements[ $i ][ "attributes" ]; 
	   
	   $oLevels[ $oElements[ $i ][ "level" ] ] = &$this->_elements[ $nIndex ];
	   
	   if( is_object( $oLevels[ $oElements[ $i ][ "level" ] - 1 ] ) )
		$oLevels[ $oElements[ $i ][ "level" ] - 1 ]->appendChild( &$this->_elements[ $nIndex ] );
	  }
	  else
	   array_slice( $oElements, $i, 1 );
	 } 
	 
	 $this->firstChild = &$this->_elements[ 0 ];
	 $this->_elements[ 0 ]->parentNode = &$this;	
	}
	
	// ==================== Metodos GET ========================
	
	function getPath()
	{ return( $this->_path ); }
	
	# Devuelve un array con aquellos elementos cuyo tag coincida con
	# alguno de los elementos del array $oTagName
	
	function getElementsByTagName( $sTagName )
	{
	 for( $i = 0; $i < count( $this->_elements ); $i++ )
	 {
	  if( $sTagName == "*" || eregi( "^($sTagName)$", $this->_elements[ $i ]->nodeName ) )
	   $oMatches[] = &$this->_elements[ $i ];
	 }
	 
	 return( $oMatches );
	}
	
	# Devuelve el primer elemento cuyo identificativo sea igual a $sID
	
	function &getElementById( $sID )
	{ 
	 for( $i = 0; $i < count( $this->_elements ); $i++ )
	 {
	  if( strcmp( $this->_elements[ $i ]->getAttribute( "id" ), $sID ) == 0 )
	   return( $this->_elements[ $i ] );
	 }
	}
	
	# Devuelve un array de elementos cuyos atributos '$sName' tengan 
	# un valor identico al indicado en el segundo parametro '$sValue'
	
	function getElementsByAttribute( $sName, $sValue )
	{ 
	 for( $i = 0; $i < count( $this->_elements ); $i++ )
	 {
	  if( $this->_elements[ $i ]->getAttribute( $sName ) == $sValue )
	   $oMatches[] = &$this->_elements[ $i ];
	 }
	 
	 return( $oMatches );
	}	
	
	// ==================== Otros metodos ======================
	
	function isValid()
	{ return( is_object( $this->firstChild ) ); }
	
	# Crea un nuevo elemento con el tag, valor y atributos especificados
	
	function &createElement( $sTagName = NULL, $sValue = NULL, $oAttributes = array() )
	{ 
	 $oElement = new DocumentElement( $sTagName, $sValue );
	 $oElement->attributes = $oAttributes;
	 $oElement->_root = &$this;
	 
	 return( $oElement ); 
	}
	
	function createCdata( $sString )
	{ return( $this->createElement( NULL, $sString ) ); }
		
	function toString( $bFormatted = false, $bIncludeHeader = true )
	{ 
	 if( $bIncludeHeader == true )
	  $sReturn = "<?xml version=\"" . $this->version . "\" encoding=\"" . $this->encoding . "\" ?>\r\n\r\n";
	  
	 return( $sReturn . $this->firstChild->toString( true, false, $bFormatted ? 0 : -1 ) ); 
	}

}


class DocumentElement
{

	// ==================== Atributos ==========================

	var $nodeName			=		NULL;
	var $nodeValue			=		NULL;
	
	var $attributes			=		array();	
	
	var $parentNode			=		NULL;
	var $firstChild			=		NULL;
	var $lastChild			=		NULL;
	var $nextSibling		=		NULL;
	var $previousSibling	=		NULL;
		
	// ==================== Metodos SET ========================

	function DocumentElement( $sTagName, $sValue = NULL )
	{ 
	 $this->nodeName = $sTagName; 
	 $this->nodeValue = $sValue;
	}
	
	function setAttribute( $sKey, $sValue, $bOverWrite = true )
	{ 
	 if( $bOverWrite == true || !isset( $this->attributes[ $sKey ] ) )
	  $this->attributes[ $sKey ] = $sValue;
	}
	
	function removeAttribute( $sKey )
	{ unset( $this->attributes[ $sKey ] ); }
	
	// ==================== Metodos GET ========================

	function getContent()
	{
	 if( !is_null( $this->nodeValue ) || !$this->hasChildNodes() )
	  return( $this->nodeValue );	
	 else
	  return( $this );
	}
	
	function getAttribute( $sName )
	{ return( $this->attributes[ $sName ] ); }
	
	# Busca todos los elementos a partir de 'this' cuyo tag sea igual al patron
	# especificado en 'sTagName'
	# Esta funcion realiza una busqueda recursiva a la que podemos definir el numero
	# maximo de niveles a buscar ( predeterminado -1: todos los niveles )
	
	function getElementsByTagName( $sTagName, $nMaxLevels = -1, $nLevel = 0 )
	{ 
	 if( $nMaxLevels == -1 || $nLevel < $nMaxLevels )
	 {
	  $oMatches = array();
	  $oChild 	= &$this->firstChild;
	  
	  while( $oChild !== NULL )
	  {
	   if( $sTagName == "*" || eregi( "(" . $sTagName . ")", $oChild->nodeName ) )
		array_push( $oMatches, &$oChild );
		
	   $oMatches = array_merge( &$oMatches, $oChild->getElementsByTagName( $sTagName, $nMaxLevels, $nLevel + 1 ) );	   
	   $oChild	 = &$oChild->nextSibling;
	  }
	  
	  return( $oMatches );
	 }
	}
	
	function hasChildNodes()
	{ return( $this->firstChild !== NULL ); }
	
	function hasAttribute( $sName )
	{ return( isset( $this->attributes[ $sName ] ) ); }

	// ==================== Otros metodos ======================
	
	# Agrega un nuevo elemento hijo
	# Si es la primera vez que se le agrega un hijo, setearemos 
	# los punteros 'firstChild' y 'lastChild'
	
	function &appendChild( &$oNewChild, $nPosition = DOM_INSERT_LAST )
	{ 
	 $oNewChild->unlink();
	 $oNewChild->parentNode = &$this;
	
	 if( $this->firstChild === NULL )
	 {
	  $this->firstChild = &$oNewChild;
	  $this->lastChild  = &$oNewChild;
	 }
	 else
	 {
	  switch( $nPosition )
	  {
	   case DOM_INSERT_FIRST:
	   
	    $oNewChild->nextSibling = &$this->firstChild;
		$this->firstChild->previousSibling = &$oNewChild;
		$this->firstChild = &$oNewChild;
	   
	   break;
	  
	   case DOM_INSERT_LAST: 
	  
	  	$oNewChild->previousSibling = &$this->lastChild;
	  	$this->lastChild->nextSibling = &$oNewChild;
  	  	$this->lastChild = &$oNewChild;
	
	   break;
	  }
	 }
	 
	 return( $oNewChild );
	}
	
	# Agrega un nuevo elemento hermano, en el mismo nivel que el actual
	# y a continuacion del mismo. Tiene en cuenta si el nuevo nodo tiene
	# tambien nodos en su mismo nivel, y los enlaza correctamente
	
	function &appendSibling( &$oNewSibling, $nPosition = DOM_INSERT_AFTER )
	{
	 $oNewSibling->unlink();
	 $oNewSibling->parentNode = &$this->parentNode;
	 	
	 switch( $nPosition )
	 {
	  case DOM_INSERT_AFTER:
	  
	   if( $this->nextSibling !== NULL )
	   {
		$oNewSibling->nextSibling = &$this->nextSibling;
		$this->nextSibling->previousSibling = &$oNewSibling;
	   }
	   else
		$this->parentNode->lastChild = &$oNewSibling;
	  
	   $oNewSibling->previousSibling = &$this;
	   $this->nextSibling = &$oNewSibling;
	   
	  return( $oNewSibling );
	  
	  case DOM_INSERT_BEFORE:
	  
	   if( $this->previousSibling !== NULL )
	   {
	    $oNewSibling->previousSibling = &$this->previousSibling;
		$this->previousSibling->nextSibling = &$oNewSibling;
	   }
	   else
	    $this->parentNode->firstChild = &$oNewSibling;
		
	   $oNewSibling->nextSibling = &$this;
	   $this->previousSibling = &$oNewSibling;
	   
	  return( $oNewSibling );
	 }
	}
	
	# Reemplaza un nodo
	
	function &replace( $oNode )
	{
	 $this->nodeName   = $oNode->nodeName;
	 $this->nodeValue  = $oNode->nodeValue;
	 $this->attributes = $oNode->attributes;
	 
	 unset( $this->firstChild, $this->lastChild );
	 
	 if( $oNode->hasChildNodes() )
	 {
	  $this->firstChild = &$oNode->firstChild;
	  $this->lastChild  = &$oNode->lastChild;
	  $oNextSibling 	= &$oNode->firstChild;
	  
	  while( $oNextSibling !== NULL )
	  {
	   $oNextSibling->parentNode = &$this;
	   $oNextSibling = &$oNextSibling->nextSibling;
	  }
	 }
	 
	 return( $this );
	}
	
	# Clona un nodo y todos sus subhijos ( estos ultimos solo en caso de que
	# el primer parametro sea 'true'
	
	function &copy( $bCloneChildren = true )
	{
	 $oNewNode = $this->_root->createElement( $this->nodeName, $this->nodeValue );
	 $oNewNode->attributes = $this->attributes;
	 $oNewNode->_root = &$this->_root;
	 
	 if( $bCloneChildren == true && $oChild = &$this->firstChild )
	 {
	  while( $oChild !== NULL )
	  {
	   $oNewChild = &$oChild->copy( $bCloneChildren );
	   $oNewNode->appendChild( &$oNewChild, DOM_INSERT_LAST );
	   $oChild = &$oChild->nextSibling;
	  }
	 }
	
	 return( $oNewNode );
	}
	
	# Desvincula el no

i dont knew but may be this attachment may work

Thanks praveen..
can u see this attachment..plz do that.. here also using php4..

Thank u once again.....

hi saritha, i have made little modifications to insert names in add content column

Attachments
<? 
ob_start();
include("config.php");
if($_SERVER['REQUEST_METHOD']=='POST')
{
$res="select * from addcontent where subcourse='".$_POST['subcname']."' and content='".$_POST['content']."' ";
$res1=mysql_query($res);
$num1=mysql_num_rows($res1);
			if($num1==0)
			{
			echo $_POST['subcourse'];
			echo $co="select * from courses where id='".$_POST['course']."'";
			$co1=mysql_query($co) or die("unable to select");
			$crow=mysql_fetch_assoc($co1);
			
			echo $subc="select * from courses where id='".$_POST['subcourse']."'";
			$subc1=mysql_query($subc);
			$srow=mysql_fetch_assoc($subc1);
			$qry2="INSERT INTO addcontent(course,subcourse,content) VALUES ('".$crow['course']."','".$srow['course']."','".$_POST['content']."')";
			 $res2=mysql_query($qry2) or die(mysql_error());
			
			 header("location:addcontent.php?msg=added");
			}
			else{
			echo "name and fee already exits";
			}
			}
  $qry4="select * from courses where parentid='0'";
$res4=mysql_query($qry4) or die(mysql_error());
$num4=mysql_num_rows($res4);			
?>
<?
$res_c=mysql_query("select * from courses where parentid=0");
echo "<script language=javascript>\n";
echo "function chgselcat() {\n";
echo "var d=document.form;\n";
echo "if(d.course.value==0) {\n";
	echo "d.subcourse.options.length = 0;\n";
	echo "d.subcourse.options[0]=new Option(\"Select \",\"\")\n";
echo "}\n";
while($row_c=mysql_fetch_array($res_c,MYSQL_BOTH)){
echo "if(d.course.value==".$row_c['id'].") {\n";
		echo "d.subcourse.length=0;\n";
		$sub_res=mysql_query("SELECT * from courses where parentid=".$row_c['id']."  ");  
		$i=1;
		echo "d.subcourse.options[0]=new Option(\"--Select Sub Category-- \",\"\")\n";
		while($sub_row=mysql_fetch_array($sub_res,MYSQL_BOTH)){
			echo "d.subcourse.options[".$i."]=new Option('".$sub_row['course']."','".$sub_row['id']."');\n";
			$i=$i+1;
		}
echo "}\n";
}
echo "}</script>\n"; 
?>


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>

<body>
<table width="100%" height="208" border="0">
  <tr>
    <th width="87%" height="21" scope="col"> <div align="right">
      <table width="60%" border="0">
        <tr>
          <th width="34%" scope="col"><div align="right"><a href="addcourses.php">Add Courses</a></div></th>
          <th width="40%" scope="col"><div align="right"><a href="addsubcourses.php">Add Sub Courses</a></div></th>
          <th width="26%" scope="col"><div align="right">Add Content</div></th>
        </tr>
      </table>
    </div></th>
    <th width="13%" scope="col"><a href="logout.php">Logout</a></th>
  </tr>
  <tr>
    <td><form name="form" method="post" action="">
      <table width="100%" height="118" border="0">
	  

        <tr>
          <td><div align="right"><strong>Course</strong></div></td>
          <td><div align="center"><strong>:</strong></div></td>
          <td><select name="course" class="box2" id="course" onChange="chgselcat();">
            <option value="">------Select course-------</option>
            <?  while($row4=mysql_fetch_array($res4))
			
					{ ?>
            <option value="<?=$row4['id']?>">
            <?=$row4['course']?>
            <? }
				?>
            </option>
          </select></td>
        </tr>
		  <?  $q="SELECT * FROM courses WHERE parentid='".$row4['id']."'";;
					$r=mysql_query($q) or die(mysql_error());
					$n=mysql_num_rows($r);
					if($n>0)
					{
					?>
        <tr>
          <th width="57%" scope="col"><div align="right">Sub Course </div></th>
          <th width="8%" scope="col">:</th>
          <th width="35%" scope="col" align="left"><select name="subcourse" class="box2" id="subcourse">
            <option value="">------Selectsubcourse-------</option>
            <?  while($ro=mysql_fetch_array($r))
					{ ?>
            <option value="<?=$ro['course']?>">
            <?=$ro['course']?>
            <? }
				}?>
            </option>
          </select></th>
        </tr>
        <tr>
          <td><div align="right"><strong>Content</strong></div></td>
          <td><div align="center"><strong>:</strong></div></td>
          <td><textarea name="content" id="textfield2" rows="5" cols="30"></textarea></td>
        </tr>
        <tr>
          <td><div align="right">
            <input type="submit" name="button" id="button" value="Add Content" />
          </div></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
      </table>
    </form></td>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>

Hi langsor..
Thank u verymuch...

here i got an error..
"Fatal error: Class 'DOMDocuemt' not found in C:\wamp\www\training\content.php on line 5 "


can u explain me please....

Thanks in advance

It's a type-o, should be DOMDocument

Also, the SELECT `cname` FEOM sql statements should be SELECT `cname` FROM

There may be others ... ;-)

This article has been dead for over six months. Start a new discussion instead.