PHP Applications
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Applications

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old March 17th, 2007, 08:18 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
php application problem+HTML

Dear all,

I have two problems,
1).I want to prevent enter one Supvisor number ='$Sup_Emp_No' by two
different supordinates ='$Sub_Emp_No' into the system.

2).How can incorporate HTML CODES to the $message of the mail function.I am
using "wamp5" for this application.

Can you help me please.


<?php
session_start();
if(!isset($_SESSION["Emp_No"])||!isset($_SESSION["Dep_Name"])||!isset($_SESSION["User_Level"])||!isset($_SESSION["Email"])||!isset($_SESSION["First_Name"]))
{
header("Location:./error.php");
}

$empid =$_SESSION['epf_no'];
$dbhost='localhost';
$dbuser='root';
$dbpass='';
$dbname='metrosite';



if(isset($_POST["Submit"])){
$perc = $_POST["total"];
$comments = $_POST["comments"];
$Sub_Emp_No = $_POST["Sub_Emp_No"];
$Sup_Emp_No = $_POST["Sup_Emp_No"];
//$sup_no = $_POST["sup_no"];


$conn = mysql_connect($dbhost,$dbuser,$dbpass)or die (mysql_error());
mysql_select_db($dbname, $conn) or die (mysql_error ());

$sql = "INSERT INTO sub_app ( Sub_Emp_No , Sup_Emp_No , Perc , Comments )
VALUES ( '$Sub_Emp_No', '$Sup_Emp_No', '$perc', '$comments');";

if(!mysql_query($sql,$conn)){

$mess =mysql_errno($conn);
if($mess=="1062"){
$mess = "Entry was already entered !";
}
else {
echo "error <br>";
echo mysql_error($conn);
}
}
else{
$mess = "Successfully entered !";
}
{
$query1 = "SELECT * FROM emp WHERE Emp_No= '$Sub_Emp_No'";
$query2 = "SELECT * FROM emp WHERE Emp_No= '$Sup_Emp_No'";
$stmnt ="SELECT * FROM emp ";
$result = mysql_query($query1,$conn);
$row1 = mysql_fetch_assoc($result);
$from = $row1["Email"];

$result2 = mysql_query($query2,$conn);
$row2 = mysql_fetch_assoc($result2);
$to = $row2["Email"];

//$result3=mysql_query($query2,$conn);
//$row3 = mysql_fetch_assoc($result3);



//$mess = "Entry was already entered !";


switch ($row1["User_Level"]) {
case 1 :
case 2 :
case 3 :
$r = mysql_query($stmnt,$conn);
while($object =mysql_fetch_object($r)){
if($object->User_Level == 4 && $object->Dep_Name==$row1["Dep_Name"]){
$to=$object->Email;
break;
}
}
break;
case 5 :
$to = "ceo@wasantha.lk";
break;
case 6 :
$to = "nimal@wasantha.lk";
break;

}

$subject ="Employee ".$row1["First_Name"]." evaluated you on Subordinate's
angle.";
$message = "<strong>Subordinate evaluation percentage is:"
.$perc.".</strong>rnrnYou may see your Overall evaluation by clicking
the 'Whole summary' on your pagernrnBut wait till you finish your
appraisal discussion with your superior(Dept. Head) and Peer's evaluation on
you where you will get an e-mail message.rnrn rn rn Best regards,
rn HR Dept. rn";


//mail($to,$subject,$message)
//or print "Could not send mail";
$headers = 'From:'.$from. "rn" .
'Reply-To:'.$to."rn" .
'X-Mailer: PHP' . phpversion();
mail($to,$subject,$message, $headers)
or print "Could not send mail";
}
mysql_close($conn);

}

?>


regards
wasantha

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Applications > php application problem+HTML


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway