add-employee.php ( File view )

  • By cox 2014-08-14
  • View(s):156
  • Download(s):9
  • Point(s): 2
			<?php
include('includes/start.php');
include('includes/header.html');
?>

<?php
error_reporting(0);
$errors=array();

if(isset($_POST['submitted'])){


$uploadLocation  = "C:\apachefriends\xampp\OnlineLeaveSystem\resume";
 	$target_path = $uploadLocation . $_FILES['resume']['fname'];
 	if(move_uploaded_file($_FILES['resume']['fname'], $target_path)){
    echo "upload success";  
}

if(empty($_POST['fname'])){

$errors[]='Please Enter First Name of the New Employee!'; 

}else{

 $fname=trim($_POST['fname']);
 
}
 
 if(empty($_POST['mname'])){

$errors[]='Please Enter Middle Name of the New Employee!';

}else{

 $mname=trim($_POST['mname']);
 
}
 
 if(empty($_POST['lname'])){

$errors[]='Please Enter Last Name of the New Employee!';

}else{

 $lname=trim($_POST['lname']);
 
}
 
 
  if(empty($_POST['bday'])){

$errors[]='Please Enter Birthday of the New Employee!';

}else{

 $bday=trim($_POST['bday']);
 
}
 
  if(empty($_POST['age'])){

$errors[]='Please Enter Age of the New Employee!';

}else{

 $age=trim($_POST['age']);
 
}
 
 
  if(empty($_POST['gen'])){

$errors[]='Please Enter Gender of the New Employee!';

}else{

 $gen=trim($_POST['gen']);
 
}
 
 
  if(empty($_POST['add'])){

$errors[]='Please Enter Address of the New Employee!';

}else{

 $add=trim($_POST['add']);
 
}
 
 if(empty($_POST['stat'])){

$errors[]='Please Enter Status of the New Employee!';

}else{

 $stat=trim($_POST['stat']);
 
}
 
    if(empty($_POST['cont'])){

$errors[]='Please Contact Number of the New Employee!';

}else{

 $cont=trim($_POST['cont']);
 
}
 
 if(empty($_POST['pos'])){

$errors[]='Please Enter Position of the New Employee!';

}else{

 $pos=trim($_POST['pos']);
 
}
 $bday=$_POST['mm'].' '.$_POST['dd'].','.$_POST['yy'];
 $day=$_POST['mm'].$_POST['dd'].','.$_POST['yy'];
 $date = date('Y-m-d');
list($yr, $mon, $dy) = explode("-",$date);

  if($fname && $mname && $lname && $bday && $age  && $gen && $stat  && $add && $cont  && $pos){

include("../dbcon.php");   // Include the database class
$query = "INSERT INTO employee (eid, fname, mname, lname, bday, age, gender, address, status, contact, posid, date_added, added_by) VALUES ('$_POST[eid]', '$_POST[fname]', '$_POST[mname]', '$_POST[lname]', '$bday', '$_POST[age]', '$_POST[gen]', '$_POST[add]', ' $_POST[stat]', '$_POST[cont]', '$_POST[pos]', NOW(), '$_SESSION[fname]')";
 $result = @mysql_query($query);
 if($result){

 echo '<h3><center><b>New Employee Successfully Added!</b></center></h3>';
 echo "<br><br><br>";
  exit();
  
}else{

 echo '<h3 id="mainhead">System Error</h3>
 <p class="error">Employee can not be added.</p>';
 echo '<p>'.mysql_error().'<br /><br />Query: '.$query.'</p>';
 exit;

}


}else{

echo '<h3 id="mainhead">Error!</h3>
<p class="error">Erros Occured:<br />';
foreach($errors as $msg){

echo "-$msg<br />\n";

}
echo '</p><p>Please try again!</p><p><br /></p>';

}

 
}
?>
<center>
<br><br>
<form action="add-employee.php" method="post">
<table align="center" border="2" bgcolor="lightgreen" cellpadding="2" cellspacing="3" cols="2" width="360"><font color="black">
<tr>
<td><b>Employee ID:</td> <td><input type="text" name="eid" size="30" value="<?php if(isset($_POST['eid'])) echo $_POST['eid']; ?>" /></td></tr>
<tr>
<tr>
<td><b>First Name:</td> <td><input type="text" name="fname" size="30" value="<?php if(isset($_POST['fname'])) echo $_POST['fname']; ?>" /></td></tr>
<tr>
<td><b>Middle Name:</td> <td><input type="text" name="mname" size="30" value="<?php if(isset($_POST['mname'])) echo $_POST['mname']; ?>" /></td></tr>
<tr>
<td><b>Last Name:</td>  <td><input type="text" name="lname" size="30" value="<?php if(isset($_POST['lname'])) echo $_POST['lname']; ?>" /></td></tr>
<tr>
<td><b>Birth Date:</span></td>
                        <td valign="top" size="28" value="<?php if(isset($_POST['bday'])) echo $_POST['bday']; ?>" /><label>
                          <select name="mm">
			  <option selected="selected"></option>
                            <option>January</option>
                            <option>Febuary</option>
			    <option>March</option>
			    <option>April</option>
			    <option>May</option>
			    <option>June</option>
			    <option>July</option>
			    <option>August</option>
			    <option>September</option>
			    <option>October</option>
			    <option>November</option>
			    <option>December</option>
			    		    </select>
			<select name="dd">
			  <option selected="selected"></option>
                            <option>1</option>
                            <option>2</option>
			    <option>3</option>
			    <option>4</option>
			    <option>5</option>
			    <option>6</option>
			    <option>7</option>
			    <option>8</option>
			    <option>9</option>
			    <option>10</option>
			    <option>11</option>
			    <option>12</option>
			    <option>13</option>
			    <option>14</option>
			    <option>15</option>
			    <option>16</option>
			    <option>17</option>
			    <option>18</option>
			    <option>19</option>
			    <option>20</option>
			    <option>21</option>
			    <option>22</option>
			    <option>23</option>
			    <option>24</option>
			    <option>25</option>
			    <option>26</option>
			    <option>27</option>
			    <option>28</option>
			    <option>29</option>
			    <option>30</option>
			    <option>31</option>
                </select>
			    <select name="yy">
			  <option selected="selected"></option>
                            <option>1960</option>
                            <option>1961</option>
			    <option>1962</option>
			    <option>1963</option>
			    <option>1964</option>
			    <option>1965</option>
			    <option>1966</option>
			    <option>1967</option>
			    <option>1968</option>
			    <option>1969</option>
			    <option>1970</option>
			    <option>1971</option>
			    <option>1972</option>
			    <option>1973</option>
			    <option>1974</option>
			    <option>1975</option>
			    <option>1976</option>
			    <option>1977</option>
			    <option>1978</option>
			    <option>1979</option>
			    <option>1980</option>
			    <option>1981</option>
			    <option>1982</option>
			    <option>1983</option>
			    <option>1984</option>
			    <option>1985</option>
			    <option>1986</option>
			    <option>1987</option>
			    <option>1988</option>
			    <option>1989</option>
			    <option>1990</option>
			   
                       </select>  
			    </td></tr>
			    
<tr>
<td><b>Age:</td>  <td><input type="text" name="age" size="1" value="<?php if(isset($_POST['age'])) echo $_POST['age']; ?>" /></td></tr>
<tr>
<td><b>Gender:</span></td>
                        <td valign="top" size="30" value="<?php if(isset($_POST['gendr'])) echo $_POST['gendr']; ?>" /><label>
                          <select name="gen">
			  <option selected="selected"></option>
                            <option>Male</option>
                            <option>Female</option>
                            </select>
			    <tr>
<td><b>Address:</td>  <td><input type="text" name="add" size="30" value="<?php if(isset($_POST['add'])) echo $_POST['add']; ?>" /></td></tr>
<tr>
<td><b>Status:</span></td>
                        <td valign="top" size="30" value="<?php if(isset($_POST['stat'])) echo $_POST['stat']; ?>" /><label>
                          <select name="stat">
			  <option selected="selected"></option>
                            <option>Single</option>
                            <option>Married</option>
			    <option>Widow</option>
			    <option>Widower</option></td></tr>
<tr>
<td><b>Contact Number:</td>  <td><input type="text" name="cont" size="30" value="<?php if(isset($_POST['cont'])) echo $_POST['cont']; ?>" /></td></tr>
<tr>
<td><b>Position Code:</span></td>
                        <td valign="top" value="<?php if(isset($_POST['pos'])) echo $_POST['pos']; ?>" />
			<select name="pos">
                            <option selected="selected"></option>
			    <option>AD-1</option>
			    <option>DR-2</option>
			    <option>FC-3</option>
			    <option>PR-4</option>
			    <option>PE-5</option>
			     </td></tr>
			     <tr><td><b>Resume</td>
<td><input type="hidden" name="MAX_FILE_SIZE" value="100000" />
<input type="file" name="resume" size="18"></td></tr>
<tr>
 <td><b>Date Added:</td>
	<td><label>
          <input name="date" type="text" id="date" size="30" value="<?php echo date('Y-m-d'); ?>" readonly="readonly" />
          </label>
         <label></label></td>

         </tr>
<tr><td><b>Added by:</span></td>
                        <td valign="top"><input type="text" name="addedby" id="addedby" size="30" value="<?php 
			  echo $_SESSION['fname']; 
			  ?>" readonly="readonly" /></td>                  
                      
		</tr>
<td>&nbsp;</td>
<td><div align="center"><input type="submit" name="submit" value="Add" />
<INPUT type="Reset" VALUE="Clear"></div>
<input type="hidden" name="submitted" value="TRUE" />

</td>
</font></table>
</form>

<?php
require_once('../includes/footer.html');
?>

			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 2

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
add-employee.php8.98 kB04-07-14 10:43
add-user.php3.26 kB04-07-14 10:27
approve.php157.00 B07-02-09 04:33
date-added.php496.00 B14-02-09 00:10
db-backup-1371292492-5cac8f65a378cc19b150279db357c567.sql3.23 kB15-06-13 06:34
db-backup-1371360757-5cac8f65a378cc19b150279db357c567.sql3.80 kB16-06-13 01:32
db-backup-1371377572-5cac8f65a378cc19b150279db357c567.sql4.88 kB16-06-13 06:12
db-backup-1402914697-5cac8f65a378cc19b150279db357c567.sql6.12 kB16-06-14 13:31
db_backup.php1.79 kB09-11-08 22:21
del-users.php2.39 kB09-02-09 14:49
delete-employee.php2.51 kB07-02-09 05:11
delete-users.php2.32 kB10-02-09 14:45
del_emp.php2.44 kB07-02-09 05:14
deny.php158.00 B07-02-09 04:33
edate.php499.00 B13-02-09 13:42
edit-user.php2.15 kB14-02-09 00:05
editemp-frm.php3.08 kB30-12-08 15:53
edit_emp.php5.08 kB29-11-08 23:07
emp-list.php6.30 kB04-02-09 14:35
emp-profile.php1.67 kB14-02-09 00:03
endate.php499.00 B13-02-09 13:44
fdate.php487.00 B12-02-09 13:24
footer.html104.00 B18-06-14 18:01
header.html5.94 kB18-06-14 15:10
start.php344.00 B16-12-08 05:35
dwsync.xml286.00 B18-06-14 18:01
index.php2.14 kB25-06-14 15:21
logout.php848.00 B18-06-14 17:45
main-index.php397.00 B16-06-14 13:26
month.php486.00 B11-02-09 07:10
month2.php499.00 B13-02-09 14:59
print-report.php1.17 kB11-02-09 07:07
print.php5.41 kB25-06-14 13:41
search-edit.php3.86 kB17-12-08 06:09
search-edituser.php3.86 kB17-12-08 06:11
search.php3.89 kB15-06-13 12:53
verify-editemp.php561.00 B09-02-09 08:09
verifyedit-user.php454.00 B09-02-09 14:35
view-leave.php3.06 kB17-06-13 04:32
viewedit-employee.php5.72 kB14-02-09 00:15
viewedit-user.php4.38 kB09-02-09 07:03
viewpending-leaves.php2.50 kB15-06-13 12:49
dwsync.xml860.00 B04-07-14 10:43
ccse.sql7.20 kB15-08-13 06:14
date.inc.php589.00 B07-11-08 17:12
dbcon.php467.00 B11-06-14 17:19
dapproved.php184.00 B27-02-09 02:11
ddeny.php191.00 B07-02-09 04:33
emp-profile.php1.66 kB14-02-09 00:02
footer.html104.00 B18-06-14 18:00
header.html6.01 kB18-06-14 17:50
start.php344.00 B08-09-08 13:34
dwsync.xml286.00 B18-06-14 18:00
logout.php848.00 B18-06-14 17:43
main-index.php403.00 B18-06-14 17:58
search.php3.96 kB16-06-13 00:26
view-leave.php1.98 kB16-06-13 01:29
viewpending-leaves.php2.50 kB16-06-13 00:28
dwsync.xml288.00 B18-06-14 17:58
fidfrm.php1.64 kB16-06-13 01:15
approval.jpg1.82 kB01-12-08 06:42
approved.jpg1.87 kB01-12-08 06:40
back.gif7.49 kB15-10-08 20:36
Brain_Mill_Logo_1b-1.gif8.41 kB16-02-09 13:23
cancel.gif2.49 kB11-02-09 00:45
delete.jpg1.61 kB01-12-08 06:43
disapproval.jpg1.99 kB01-12-08 06:42
disapproved.jpg2.07 kB01-12-08 06:42
edit.jpg1.35 kB30-11-08 00:37
exthome.png79.83 kB16-02-09 12:16
login.gif208.73 kB08-02-09 07:34
logo.png106.01 kB16-06-14 13:23
nzoia.jpg425.23 kB15-06-13 15:31
print2.gif2.50 kB31-12-08 03:14
resume.gif3.03 kB30-12-08 15:26
top.gif13.75 kB16-06-14 13:36
view.gif2.52 kB20-12-08 00:06
top.gif.mno113.00 B16-06-14 13:36
footer.html104.00 B16-06-14 12:39
header.html5.76 kB18-06-14 17:51
start.php344.00 B08-09-08 13:34
dwsync.xml286.00 B18-06-14 17:51
index.php2.17 kB19-06-14 10:24
leave.php8.69 kB30-07-14 17:17
logout.php842.00 B18-06-14 17:27
main-index.php380.00 B18-06-14 18:07
mysql_connect.php645.00 B07-11-08 03:55
<NSC>0.00 BSystem.ppt 1940992
Reminder.txt192.00 B12-05-09 07:22
Resume.doc35.50 kB18-06-13 00:14
search.php3.50 kB16-06-13 01:21
setid.php1.31 kB21-02-09 08:21
view-availableleave.php1.41 kB07-02-09 04:59
view-leave.php1.67 kB20-02-09 15:51
viewpending-leaves.php2.19 kB16-06-13 01:17
dwsync.xml621.00 B30-07-14 17:17
<_notes>0.00 B09-08-14 11:29
<_notes>0.00 B09-08-14 11:29
<includes>0.00 B09-08-14 11:29
<New>0.00 B0% 15-06-13
<_notes>0.00 B09-08-14 11:29
<includes>0.00 B09-08-14 11:29
<_notes>0.00 B09-08-14 11:29
<_notes>0.00 B09-08-14 11:29
<_notes>0.00 B09-08-14 11:29
<admin>0.00 B09-08-14 11:29
<database>0.00 B09-08-14 11:29
<director>0.00 B09-08-14 11:29
<images>0.00 B09-08-14 11:29
<includes>0.00 B09-08-14 11:29
<presentation>0.00 B09-08-14 11:29
<resume>0.00 B09-08-14 11:29
<sick-leave>0.00 B28-04-09 00:20
<_notes>0.00 B09-08-14 11:29
<OnlineLeaveSystem>0.00 B09-08-14 11:29
...
Sponsored links

add-employee.php (931.49 kB)

Need 2 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D