Login   Register  
PHP Classes
elePHPant
Icontem

Hi..

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      DrasticTools  >  All threads  >  Hi..  >  (Un) Subscribe thread alerts  
Subject:Hi..
Summary:drastic grid table doubt
Messages:1
Author:danielbala
Date:2012-02-18 22:02:28
 

  1. Hi..   Reply   Report abuse  
Picture of danielbala
danielbala
2012-02-18 22:02:28
Hi...

Im using drasticgrid tool..

im using in the php form..

Now i have form field current employee name and below that this drasticgrid table will display a table ..

im using checkbox in the table ..when i click the check box value 1 is posted to the DB table..but the form field current employee name value is not posted to the DB table field AssignedTo..

how to implement this..
this is my code

<?php

session_start();
define("PATHDRASTICTOOLS", "");
include (PATHDRASTICTOOLS . "config.php");
include (PATHDRASTICTOOLS . "drasticSrcMySQL.class.php");

$options = array (
"add_allowed" => false,
"delete_allowed" => false,
"defaultcols" => array( "JOB_STATUS" => "To be Assigned")
);

class mysrc extends drasticSrcMySQL {
protected function select($emp_name){

if ( $emp_name != '') {
$emp_name=mysql_real_escape_string($_SESSION['emp_name']);
$sql="UPDATE `job_det` SET ASSIGNED_TO='$emp_name',Apply='0' WHERE Apply='1'";
$result2=mysql_query($sql) or die(mysql_error());
}
}

$emp_name = $_SESSION['emp_name'];
$src = new mysrc($host, $username, $password, $db_name, "job_det", $options);
$src->select($emp_name);

}
$src =new drasticSrcMySQL($host, $username, $password, $db_name, "job_det",$options);
?>

<?php
if (isset($_SESSION['id'])){
$loginid=$_SESSION['id'];
}
if (isset($_SESSION['T_UserName'])){
$T_UserName=$_SESSION['T_UserName'];
}

if (isset($_GET['id'])){
$loginid=$_GET['id'];
}
//Get login username if using GET
$loginid=mysql_real_escape_string($loginid);
$query = "SELECT username,fullname FROM `logindetails` WHERE id=$loginid";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
$T_UserName=$row[0];
$T_UserFullName=$row[1];
?>

<?php
if (isset($_SESSION['emp_id'])){
$loginid=$_SESSION['emp_id'];
}
if (isset($_SESSION['emp_name'])){
$CurrentEmpName=$_SESSION['emp_name'];
}
if (isset($_GET['emp_id'])){
$loginid=$_GET['emp_id'];
//Get login username if using GET
$loginid=mysql_real_escape_string($loginid);
$query1 = "SELECT `emp_name` FROM `login` WHERE emp_id=$loginid";
$result1 = mysql_query($query1);
$row = mysql_fetch_row($result1);
$CurrentEmpName=$row[0];
}
?>

<form action="" method="post" enctype="multipart/form-data" name="ActivityPhoneCallForm" target="_self">
<br />
<br />
<table border="1">
<tr width="569" colspan="2">
<td>
&nbsp;&nbsp;Current User : &emsp;&emsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="CurrentUser" type="text" disabled id="UserId" size="35" maxlength="35" readonly class="disabled" value="<?php if (isset($T_UserName)){echo $T_UserName;} ?>"/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&emsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Activity :
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&emsp;
<input name="LogActivity" type="text" disabled id="ActLog" size="35" Value="List New Jobs" maxlength="35" readonly class="disabled" />&emsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;Current Employee Name : &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<input name="CurrentEmpName" type="text" disabled id="CurrentEmpId" size="35" maxlength="35" readonly class="disabled" value="<?php if (isset($T_UserFullName)){echo $T_UserFullName;} ?>"/>
</td>
</tr>
</table>
<br />


<table width="1150" height = "200" border="1">
<tr>
<td>

<div id="grid1"></div>
<script type="text/javascript" src="js/mootools-1.2-core.js"></script>
<script type="text/javascript" src="js/mootools-1.2-more.js"></script>
<script type="text/javascript" src="js/drasticGrid.js"></script>
<script type="text/javascript">

var thegrid = new drasticGrid('grid1', {pathimg:"img/", pagelength:10,
columns: [
{name: 'JOB_ID',width:40},
{name: 'ASSIGN_DATE',editable:false,width:80},
{name: 'CLIENT_NAME',editable:false,width:140},
{name: 'JOB_NAME',editable:false,width:100},
{name: 'TASKS_INVOLVED',editable:false,width:140},
{name: 'ASSIGNED_TO',editable:true,width:100},
{name: 'REMARKS', editable: true,width:140},
{name: 'EXP_COMPL_DATE',editable:true,width:80},
{name: 'JOB_STATUS',editable:true,width:100},
{name: 'MANAGER_APPR',editable:false,width:80},
{name: 'Apply'}
]
});
</script>
</td>
</tr>
</table>
<br />
<br />
&emsp;&emsp;

<input type="submit" name="AssignJob" id="AssignJobID" value="&emsp;&emsp;Assign Job&emsp;&emsp;" class="EmpFormButton"/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="reset" name="AddJobCancel" id="AddJobCancelID" value="&emsp;&emsp;Cancel&emsp;&emsp;" class="EmpFormButton"/>
</form>
</div>


The AssignedTo field in the DB table job_det should be posted with the current employee name for values "1"