Location: PHPKode > projects > ERPSOD > erpsod/usertask1.php
<?PHP
include_once("config.php");

session_start();
$userid=$_SESSION ["suser"];


$form1=$_GET["form"];
$action=$_POST["command"];
$id=$_POST["tasklist"] ;


$sql="select logonid,name from erpuser where erpuserid=$userid";
$result = mysql_query($sql);
$num_rows = mysql_num_rows($result);
if ($num_rows <>0){
	$row = mysql_fetch_row($result);
	$logonid= $row[0];
	$name = $row[1];
}

if ($form1=="usertask1"){
	if ($action == "Cancel") {
		header('Location: user_edit.php');
	} else{
		$sql="SELECT * FROM usertask where taskid=$id and erpuserid=$userid";

		$result = mysql_query($sql);
		$sodtel = mysql_num_rows($result);
		if ($sodtel==0){
			$sql="INSERT INTO usertask VALUE ($userid,$id)";
			$result = mysql_query($sql);
		}
		header('Location: usertask.php');
	}
} else {

	if ($action=='Add'){
		$taskid=0;
	}
	if ($action=='Delete'){
		$sql="DELETE FROM usertask WHERE taskid=$id and erpuserid=$userid";
		$result = mysql_query($sql);
		header('Location: usertask.php');
	}
	if ($action=='Done'){
		header('Location: user_edit.php');
	}
}
?>
<HTML>
<HEAD>
<link rel="stylesheet" type="text/css" href="<?PHP echo $style ?>">
<script language="JavaScript1.2" src="js/coolmenus4.js">
</script>
</HEAD>
<body bgcolor="#ffffff">
<script language="JavaScript1.2" src="js/erpsod.js">
</script><br><br>
<h3>Select tasks for : </h3>
<?php 
echo $logonid;
echo "-->";
echo $name ;?>
<FORM ACTION="usertask1.php?form=usertask1" METHOD="POST">
<INPUT TYPE="HIDDEN" NAME="FormName" VALUE="soddep1">
<INPUT TYPE="HIDDEN" NAME="id" VALUE="<?php echo $id ?>">
<INPUT TYPE="HIDDEN" NAME="userid" VALUE="<?PHP echo $userid ?>">
<table border=1 cellpadding=4 cellspacing=0 bgcolor="AQUA"><tr><td>
<table border=0 cellpadding=4 cellspacing=0>
<tr>
<td>Available Tasks</td>
<td><?PHP echo html_drop_down (10,"tasklist","erptask","taskid","taskname","taskid"); ?></td>
</tr>
<tr>
	<td colspan=2 align="right">
		<INPUT TYPE="SUBMIT" NAME="command" VALUE="Submit">
		<INPUT TYPE="SUBMIT" NAME="command" VALUE="Cancel">
	</td>
</tr>
</table>
</td></tr></table>
</FORM>
</BODY>
<?php
include_once("footer.php");
?>
</HTML>
Return current item: ERPSOD