Location: PHPKode > scripts > Create Your Own Directory > cms/HRAS/users/editcnt.php
<?php
require_once "../../auth/config.php";
$link = mysql_connect($hostname, $username,$password);
$res=mysql_select_db($dbname,$link);
$id = $_GET['tid'];
$cntidd = $_GET['cntidd'];
$id1 = $_GET['id'];
$str="select * from cntfields where catid=$id";
$strr="select * from cnt where cntid=$cntidd";
//echo"$strr";
$re=mysql_query($str);
$ree=mysql_query($strr);
while($rowss=mysql_fetch_array($ree,MYSQL_ASSOC))
{ 
$contents=$rowss['contents'];
 $cnts=split('####',$contents);

}
$sstr="<form name=fm3 method=POST action=\"edit.php?cntid=$cntidd&subb=yes&sub=yes\"  ><table bgcolor=#efefef align=center valign=top width=70% height=100% >";
$i=0;
$present=no;
while($rows=mysql_fetch_array($re,MYSQL_ASSOC))
{ 
	$catid=$rows['catid'];
	$fname=$rows['fname'];
	$inputtype=$rows['inputtype'];
	$defaultval=$rows['defaultval'];
      $present='yes';

$sstr=$sstr."<tr><td width=50%>$fname</td><td width=50%>";
if($inputtype=='selectbox')
{
	$val=explode(',',$defaultval);
	$ct=count($val);
	$sstr=$sstr."<select name=nam[$i]>";
	$tmp="";
	for($k=0;$k<=$ct;$k++)
	{
            if($cnts[$i]==$val[$k])
            {
		$tmp=$tmp."<option value=$val[$k] selected>$val[$k]</option>";
            }else
            {
		$tmp=$tmp."<option value=$val[$k]>$val[$k]</option>";

             }

	}
	
	$sstr=$sstr.$tmp."</select></td></tr>";
}else if($inputtype=='textbox'){

$sstr=$sstr."<input type=$inputtype id=id$i name=nam[$i]  value=$cnts[$i]></td></tr>";

}else if($inputtype=='textarea'){

$sstr=$sstr."<textarea id=id$i name=nam[$i] >$cnts[$i]</textarea></td></tr>";

}



$i=$i+1;
}

if($present=='yes')
{
	$sstr=$sstr."<tr><td colspan=2 align=right><br><input type=submit name=submi value='Submitform'>
	<input type=hidden name=tabid value=$id>
	<input type=hidden name=id value=$id1>
     	<input type=hidden name=sub value='yes'></input></td></tr><tr><td colspan=2><font color=green align=center height=200> <b>*</b>   Enter values for mandatory fields</font>
	</td></tr></table>"; 
echo"$sstr";

}else{

 echo"<font color=green>Content for the selected category is not present</font>";

}
?>


Return current item: Create Your Own Directory