ESH/directory.php
2024-10-23 18:28:06 +05:30

189 lines
5.5 KiB
PHP

<?php
include('pop_up_top.php');
?>
<?php
if($frmacn=='Update')
{
for($i=0;$i<$A;$i++)
{
$multi_data = ${"B$i"};
for($j=0;$j<$multi_data;$j++)
{
$sql="update directory set user_name = '".${"user_id$i"}."','".${"first_name$i"}."','".${"last_name$i"}."', location = '".${"location$i"}."', department = '".${"department$i"}."', email = '".${"email$i"}."' , tel= '".${"tel$i"}."', ext= '".${"ext$i"}."' , mobile= '".${"mobile$i"}."'";
$res=@mysqli_query($conn,$sql) or die(@mysqli_error($conn$sql));
}
}
}
?>
<?php
if($frmacn=='Insert')
{
for($i=0;$i<$add_count;$i++)
{
$multi_data = ${"count_place$i"};
for($j=0;$j<$multi_data;$j++)
{
$sql="insert into directory set user_name = '".${"user_id$i"}."','".${"first_name$i"}."','".${"last_name$i"}."', location = '".${"location$i"}."', department = '".${"department$i"}."', email = '".${"email$i"}."' , tel= '".${"tel$i"}."', ext= '".${"ext$i"}."' , mobile= '".${"mobile$i"}."'";
$res=@mysqli_query($conn,$sql) or die(@mysqli_error($conn$sql));
}
}
}
?>
<table width="100%" cellspacing="15px">
<tr>
<td align="center" width="100%" style="color:#293D3D; font-size:16px;"><img src="images/directory.jpeg" height='100' width='100'><br><b>RailTech Directory</b></td>
</tr>
</table>
<?php
if($_SESSION['user_id']=='27')
{
?>
<form action="#" method="POST" >
<table width="100%" align="center" >
<tr>
<td width='15%'align="left"></td>
<td width='25%'align="left"></td>
<td width='60%'align="left" rowspan='10'></td>
</tr>
<tr>
<td align="left">First Name : </td>
<td align="left"><textarea name="user_name" class="textbox1" style="width:100%;"><?php echo $row_directory['first_name']?></textarea></td>
</tr>
<tr>
<td align="left">Last Name : </td>
<td align="left"><textarea name="user_name" class="textbox1" style="width:100%;"><?php echo $row_directory['last_name']?></textarea></td>
</tr>
<tr>
<td align="left">User : </td>
<td align="left">
<span class="style34"><label>
<select class="selectbox" name="user_id" id="user_id" >
<option value="0">--Select--</option>
<?php
$sql_user ="select * tbl_users where user_id not in(select user_id from directory)";
generate_options($sql_user,$user_id,'user_id','user_name','');
?>
</select></label></span>
</td>
</tr>
<tr>
<td align="left">Location : </td>
<td align="left"><span class="style34"><label>
<select class="selectbox" name="location" id="location" >
<option value="">--Select--</option>
<?php
$sql_location ="select * work_place ";
generate_options($sql_location,$id,'id','place','');
?>
</select></label></span>
</td>
</tr>
<tr>
<td align="left">Department : </td>
<td align="left"><textarea name="user_name" class="textbox1" style="width:100%;"><?php echo $row_directory['department']?></textarea></td>
</tr>
<tr>
<td align="left">Email : </td>
<td align="left"><textarea name="user_name" class="textbox1" style="width:100%;"><?php echo $row_directory['email']?></textarea></td>
</tr>
<tr>
<td align="left">Tel : </td>
<td align="left"><textarea name="user_name" class="textbox1" style="width:100%;"><?php echo $row_directory['tel']?></textarea></td>
</tr>
<tr>
<td align="left">Ext : </td>
<td align="left"><textarea name="user_name" class="textbox1" style="width:100%;"><?php echo $row_directory['ext']?></textarea></td>
</tr>
<tr>
<td align="left">Mobile : </td>
<td align="left"><textarea name="user_name" class="textbox1" style="width:100%;"><?php echo $row_directory['mobile']?></textarea></td>
</tr>
<tr>
<td></td>
<td align="left"><input type="submit" name="frmacn" value="Insert" class="submitbutton" style="background:#CCFF33; border-radius:10px; color:black; font-size:11px;width:85px; height:20px;"></td>
</tr>
</table>
</form>
<?php
}
?>
<table width="100%" align="center" border='0'>
<tr><strong>
<td width='1%' border='0'></td>
<td width='3%' align="left" bgcolor="#eeeeee">Sr</td>
<td width='19%' align="left" bgcolor="#eeeeee">Name</td>
<td width='15%' align="left" bgcolor="#eeeeee">Location</td>
<td width='15%' align="left" bgcolor="#eeeeee">Department</td>
<td width='18%' align="left" bgcolor="#eeeeee">Email</td>
<td width='10%' align="left" bgcolor="#eeeeee">Tel</td>
<td width='5%' align="left" bgcolor="#eeeeee">Ext</td>
<td width='10%' align="left" bgcolor="#eeeeee">Mobile</td>
<td width='3%' align="center" bgcolor="#eeeeee">Update</td>
<td width='1%' border='0'></td>
</tr></strong>
<?php
$count = 1;
$sql_directory = "select * from directory order by user_name";
$res_directory = @mysqli_query($conn,$sql_directory);
while ($row_directory = @mysqli_fetch_array($res_directory))
{
?>
<tr>
<td border='0'></td>
<td align='center' bgcolor="#eeeeee"><?php echo $count?></td>
<td align="left" bgcolor="#eeeeee"><?php echo $row_directory['first_name']?><?php echo $row_directory['last_name']?></td>
<td align="left" bgcolor="#eeeeee"><?php echo $row_directory['location']?></td>
<td align="left" bgcolor="#eeeeee"><?php echo $row_directory['department']?></td>
<td align="left" bgcolor="#eeeeee"><?php echo $row_directory['email']?></td>
<td align="left" bgcolor="#eeeeee"><?php echo $row_directory['tel']?></td>
<td align="left" bgcolor="#eeeeee"><?php echo $row_directory['ext']?></td>
<td align="left" bgcolor="#eeeeee"><?php echo $row_directory['mobile']?></td>
<?php
if($_SESSION['user_id']=='27')
{
?>
<td align="center"><input type="submit" name="frmacn" value="Update" class="submitbutton" style="background:#CCFF33; border-radius:5px; color:black; font-size:8px;width:25px; height:10px;"></td>
<?php
}
else
{
?>
<td></td>
<?php
}
?>
<td border='0'></td>
</tr>
<?php
$count = $count +1;
}
?>
</table>
<hr>