Function echo not working
Posted: Thu Oct 27, 2011 12:17 am
session_start();
include 'conn.php';
echo 'Welcome Back: <strong>'.$_SESSION['username'].'</strong>';
if (isset($_POST['id'])&&isset($_POST['DateApplied'])&&isset($_POST['LeaveType'])&&isset($_POST['LeaveFrom'])
&&isset($_POST['LeaveTo'])&&isset($_POST['CC'])&&isset($_POST['To'])&&isset($_POST['Message'])&&isset($_POST['Subject'])){
$id =$_POST['id'];
$DateApplied =$_POST['DateApplied'];
$LeaveType =$_POST['LeaveType'];
$LeaveFrom =$_POST['LeaveFrom'];
$LeaveTo =$_POST['LeaveTo'];
$CC =$_POST['CC'];
$To =$_POST['To'];
$Message=$_POST['Message'];
$Subject =$_POST['Subject'];
if (!empty($To)&&!empty($CC)&&!empty($Message)&&!empty($Subject)){
echo 'OK';
} else {
echo 'NOT OK';
}
}
hi please help. function not empty not working. echo "NOT OK" i didnt see when i hit submit.
heres my html code.
<?
if (isset($_SESSION['username']) == true){
$username = $_SESSION['username'];
$query = mysql_query("SELECT * FROM `employeeleavedetails` WHERE `username`='$username'");
}
while ($count = mysql_fetch_assoc($query)){
?>
<html>
<center>
<table>
</center>
<form action="LeaveApplication.php" method="POST">
<table border="1" align="center" width="450" bgcolor="GRAY">
<tr>
<td colspan="1" bgcolor="GOLD" align="center"><font size="2"><strong> Applicant </font></strong></td>
</tr>
<tr>
<td><font size="2" color="white"> Employee ID:</font>
<font color="White"> <input type="text" name="assignedID" value="<?php echo $count['assignedID']?>" size="3" readonly></font>
<input type="hidden" name="id">
<tr>
<td>
<font size="2" color="white"> Employee Name: </font> <font color="white"> <input type="text" name="FullName" value="<?php echo $count['FullName']?>" readonly></font>
</td>
</tr>
</td>
</tr>
<tr>
<td colspan="4" bgcolor="GOLD" align="center"><font size="2"><strong> Employee Leave Information </font></strong></td>
<tr>
<td><font size="2" color="white"> Date Applied: <input type="text" name="DateApplied" value="<?php echo date("Y/m/d"); ?>" readonly></font>
<input type="hidden" name="DateApplied"/>
</tr>
<td><font size="2" color="white" name="LeaveType"> Type of Leave: </font>
<select name="">
<option value="Annual Leave"> Annual Leave </option>
<option value="Sick Leave"> Sick Leave </option>
<option value="Vacation Leave"> Vacation Leave </option>
</select>
</tr>
<td><font size="2" color="white"> Leave From: </font>
<input type="text" name="LeaveFrom" value="<?php echo date("Y/m/d") ?>">
<tr>
<td><font size="2" color="white"> Leave To: </font>
<input type="text" name="LeaveTo" value="<?php echo date("Y/m/d") ?>">
<tr>
<td colspan="4" bgcolor="GOLD" align="center"><font size="2"><strong> This information will be sent via Email </font></strong></td>
<tr>
<td><font size="2" color="white"> Recommending Officer:<br>
<input type="text" name="CC">Ex. my.supervisor@yahoo.com</font>
</tr>
<tr>
<td><font size="2" color="white"> Approve By:
<input type="text" name="To">Ex. hr.manager@yahoo.com </font>
</tr>
<tr>
<td><font size="2" color="white"> Subject:
<input type="text" name="Subject"></font>
</tr>
<tr>
<td><font size="2" color="white"> Remarks: </font>
<textarea cols="45" rows="5" name="Message"></textarea>
</tr>
<center><font size="2">Annual Leave: <strong><?php echo $count['AnnualLeave']?></strong>
<font size="2">Sick Leave: <strong><?php echo $count['SickLeave']?></strong>
<font size="2"> Vacation Leave: <strong><?php echo $count['VacationLeave']?></strong> </font></center>
</table>
<br>
<center>
<input type="Submit" value="Apply">
<input type="Button" value="Reset">
<input type="Button" value="Exit" onclick="window.location='logout.php'">
</center>
<br>
</form>
<? }
mysql_close(); ?>
</html>
include 'conn.php';
echo 'Welcome Back: <strong>'.$_SESSION['username'].'</strong>';
if (isset($_POST['id'])&&isset($_POST['DateApplied'])&&isset($_POST['LeaveType'])&&isset($_POST['LeaveFrom'])
&&isset($_POST['LeaveTo'])&&isset($_POST['CC'])&&isset($_POST['To'])&&isset($_POST['Message'])&&isset($_POST['Subject'])){
$id =$_POST['id'];
$DateApplied =$_POST['DateApplied'];
$LeaveType =$_POST['LeaveType'];
$LeaveFrom =$_POST['LeaveFrom'];
$LeaveTo =$_POST['LeaveTo'];
$CC =$_POST['CC'];
$To =$_POST['To'];
$Message=$_POST['Message'];
$Subject =$_POST['Subject'];
if (!empty($To)&&!empty($CC)&&!empty($Message)&&!empty($Subject)){
echo 'OK';
} else {
echo 'NOT OK';
}
}
hi please help. function not empty not working. echo "NOT OK" i didnt see when i hit submit.
heres my html code.
<?
if (isset($_SESSION['username']) == true){
$username = $_SESSION['username'];
$query = mysql_query("SELECT * FROM `employeeleavedetails` WHERE `username`='$username'");
}
while ($count = mysql_fetch_assoc($query)){
?>
<html>
<center>
<table>
</center>
<form action="LeaveApplication.php" method="POST">
<table border="1" align="center" width="450" bgcolor="GRAY">
<tr>
<td colspan="1" bgcolor="GOLD" align="center"><font size="2"><strong> Applicant </font></strong></td>
</tr>
<tr>
<td><font size="2" color="white"> Employee ID:</font>
<font color="White"> <input type="text" name="assignedID" value="<?php echo $count['assignedID']?>" size="3" readonly></font>
<input type="hidden" name="id">
<tr>
<td>
<font size="2" color="white"> Employee Name: </font> <font color="white"> <input type="text" name="FullName" value="<?php echo $count['FullName']?>" readonly></font>
</td>
</tr>
</td>
</tr>
<tr>
<td colspan="4" bgcolor="GOLD" align="center"><font size="2"><strong> Employee Leave Information </font></strong></td>
<tr>
<td><font size="2" color="white"> Date Applied: <input type="text" name="DateApplied" value="<?php echo date("Y/m/d"); ?>" readonly></font>
<input type="hidden" name="DateApplied"/>
</tr>
<td><font size="2" color="white" name="LeaveType"> Type of Leave: </font>
<select name="">
<option value="Annual Leave"> Annual Leave </option>
<option value="Sick Leave"> Sick Leave </option>
<option value="Vacation Leave"> Vacation Leave </option>
</select>
</tr>
<td><font size="2" color="white"> Leave From: </font>
<input type="text" name="LeaveFrom" value="<?php echo date("Y/m/d") ?>">
<tr>
<td><font size="2" color="white"> Leave To: </font>
<input type="text" name="LeaveTo" value="<?php echo date("Y/m/d") ?>">
<tr>
<td colspan="4" bgcolor="GOLD" align="center"><font size="2"><strong> This information will be sent via Email </font></strong></td>
<tr>
<td><font size="2" color="white"> Recommending Officer:<br>
<input type="text" name="CC">Ex. my.supervisor@yahoo.com</font>
</tr>
<tr>
<td><font size="2" color="white"> Approve By:
<input type="text" name="To">Ex. hr.manager@yahoo.com </font>
</tr>
<tr>
<td><font size="2" color="white"> Subject:
<input type="text" name="Subject"></font>
</tr>
<tr>
<td><font size="2" color="white"> Remarks: </font>
<textarea cols="45" rows="5" name="Message"></textarea>
</tr>
<center><font size="2">Annual Leave: <strong><?php echo $count['AnnualLeave']?></strong>
<font size="2">Sick Leave: <strong><?php echo $count['SickLeave']?></strong>
<font size="2"> Vacation Leave: <strong><?php echo $count['VacationLeave']?></strong> </font></center>
</table>
<br>
<center>
<input type="Submit" value="Apply">
<input type="Button" value="Reset">
<input type="Button" value="Exit" onclick="window.location='logout.php'">
</center>
<br>
</form>
<? }
mysql_close(); ?>
</html>