回声java脚本无法正常工作? [英] Echo java script not working?

查看:68
本文介绍了回声java脚本无法正常工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,



这是我的代码

 <?php  
// session_start();
include( ../ inserthistroy.php);
if(!isset($ _ SESSION [ user_name]))
{
header( 位置:http:// localhost / Mysql / Intranetportal /) ;
}
include( ../ dbconfig.php);
$ myname = $ _ SESSION [ user_name];
$ query = select * from emp_leave_status其中user_id ='$ myname';
$ data = mysql_query($ query,$ con) die( 查询错误: .mysql_error());
$ num = mysql_fetch_array($ data);

$ user_id = $ num [' user_id'];
$ user_name = $ num [' user_name'];
$ designation = $ num [' name'];
$ total_leave = $ num [' total_leave'];
$ cl = $ num [' cl'];
$ sl = $ num [' sl'];
$ pl = $ num [' pl'];
$ cl_taken = $ num [' cl_taken'];
$ sl_taken = $ num [' sl_taken'];
$ pl_taken = $ num [' pl_taken'];
$ cl_balance = $ num [' cl_balance'];
$ sl_balance = $ num [' sl_balance'];
$ pl_balance = $ num [' pl_balance'];

// /离开计算
if(isset($ _POST [ 提交]))
{

$ leavetype = $ _ POST [ leavetype];
$ nol = $ _ POST [ nol];
$ start_date = $ _ POST [ start_date];
$ end_date = $ _ POST [ end_date];
$ reason = $ _ POST [ reason];

$ query1 = 插入apply_leave
(user_id,user_name,指定,apply_date,no_of_leave,leave_start_date,leave_end_date,status1,apply_time,leave_type,reason)
values('$ myname','$ user_name','$ designation' , '$ DATE1', '$ NOL', '$起始日期', '$ END_DATE', '挂起', '$时间', '$ leavetype', '$原因');
mysql_query($ query1,$ con) die( 查询错误: .mysql_error());
// //////////////////// //////////


if(isset($ _ POST [' leavetype']))
{


if ( $ leavetype == ' PL'){
$ nol = $ _ POST [ nol];
if($ pl_balance< $ nol)
{
echo < script> alert('PL离开不足,余下的假将在CL中添加');< / script>;

$ bal_leave = $ nol - $ pl_balance ;

$ query9 = 更新emp_leave_status set pl_balance = pl_balance - $ pl_balance,pl_taken = pl_taken + $ pl_balance where user_id ='$ myname';

$ query10 = 更新emp_leave_status set cl_taken = cl_taken + $ bal_leave其中user_id ='$ myname';

}
else if ($ pl_balance> = $ nol )
{
$ query9 = update emp_leave_status set pl_balance = pl_balance - $ nol,pl_taken = pl_taken + $ nol where user_id ='$ myname';
}
}
其他 如果($ leavetype == < span class =code-string>'
SL'){
$ nol = $ _ POST [ nol];
if($ sl_balance< $ nol)
{
echo < script> alert('SL离开不足,余下的假将在CL中添加');< / script>;
$ bal_leave = $ nol - $ sl_balance ;
$ query9 = update emp_leave_status set sl_balance = sl_balance - $ sl_balance,sl_taken = sl_taken + $ sl_balance其中user_id ='$ myname';

$ query10 = 更新emp_leave_status set cl_taken = cl_taken + $ bal_leave其中user_id ='$ myname';
}
其他 如果($ sl_balance> = $ nol)
{
$ query9 = update emp_leave_status set sl_balance = sl_balance - $ nol,sl_taken = sl_taken + $ nol其中user_id ='$ myname';
}
}
其他 如果($ leavetype == < span class =code-string>' CL'){
$ nol = $ _ POST [ nol];

$ query9 = 更新emp_leave_status set cl_taken = cl_taken + $ nol其中user_id ='$ myname';

}
mysql_query($ query9);
@mysql_query($ query10);

}
$ _SESSION [' leavetype'] = $ _POST [' leavetype'];
$ _SESSION [' nol'] = $ _ POST [ nol];
$ _SESSION [' start_date'] = $ _ POST [ start_date];
$ _SESSION [' end_date'] = $ _ POST [ end_date];
$ _SESSION [' reason'] = $ _ POST [ reason];
header( 位置:http://localhost/Mysql/Intranetportal/website/apply_leave-thanks.php );
}
?>



当条件为true时,这两个警报框不起作用但是它会重定向到其他页面。

  echo   < script> alert('PL离开不足,剩余休假将在CL中添加');< / script>; 
echo < script> alert( 'SL离开不足,余下的假将加入CL');< / script>;



我该怎么办?

任何建议。



谢谢

解决方案

_SESSION [ user_name]))
{
header( 位置:http:// localhost / Mysql / Intranetportal /);
}
include( ../ dbconfig.php);


myname =


_SESSION [ USER_NAME];

Hi friends,

This my code

<?php
//session_start();
include ("../inserthistroy.php");
if(!isset($_SESSION["user_name"]))
{
header("Location:http://localhost/Mysql/Intranetportal/");
}
include ("../dbconfig.php");
$myname=$_SESSION["user_name"];
$query="select * from emp_leave_status where user_id='$myname'";
$data=mysql_query($query,$con) or die("Error in Query: " . mysql_error());
$num=mysql_fetch_array($data);

$user_id=$num['user_id'];
$user_name=$num['user_name'];
$designation=$num['designation'];
$total_leave=$num['total_leave'];
$cl=$num['cl'];
$sl=$num['sl'];
$pl=$num['pl'];
$cl_taken=$num['cl_taken'];
$sl_taken=$num['sl_taken'];
$pl_taken=$num['pl_taken'];
$cl_balance=$num['cl_balance'];
$sl_balance=$num['sl_balance'];
$pl_balance=$num['pl_balance'];

///leave calculation
if(isset($_POST["Submit"]))
{

$leavetype=$_POST["leavetype"];
$nol=$_POST["nol"];
$start_date=$_POST["start_date"];
$end_date=$_POST["end_date"];
$reason=$_POST["reason"];

$query1 = "insert into apply_leave
(user_id,user_name, designation,apply_date,no_of_leave,leave_start_date,leave_end_date,status1,apply_time,leave_type,reason)
values('$myname','$user_name','$designation','$date1','$nol','$start_date','$end_date','pending','$time','$leavetype','$reason')";
mysql_query($query1,$con) or die("Error in query:". mysql_error());
////////////////////////////////


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


if ($leavetype == 'PL') {
$nol=$_POST["nol"];
if($pl_balance<$nol)
{
echo "<script> alert('Unsufficient PL leave,Remaining Leave will be add in CL');</script>";

$bal_leave= $nol - $pl_balance;

$query9 = "update emp_leave_status set pl_balance = pl_balance - $pl_balance , pl_taken = pl_taken + $pl_balance where user_id = '$myname'";

$query10 = "update emp_leave_status set cl_taken = cl_taken + $bal_leave where user_id = '$myname'";

}
else if ($pl_balance>=$nol)
{
$query9 = "update emp_leave_status set pl_balance = pl_balance - $nol , pl_taken = pl_taken + $nol where user_id = '$myname'";
}
}
else if ($leavetype == 'SL') {
$nol=$_POST["nol"];
if($sl_balance<$nol)
{
echo "<script> alert('Unsufficient SL leave ,Remaining Leave will be add in CL');</script>";
$bal_leave= $nol - $sl_balance;
$query9 = "update emp_leave_status set sl_balance = sl_balance - $sl_balance , sl_taken = sl_taken + $sl_balance where user_id = '$myname'";

$query10 = "update emp_leave_status set cl_taken = cl_taken + $bal_leave where user_id = '$myname'";
}
else if ($sl_balance>=$nol)
{
$query9 = "update emp_leave_status set sl_balance = sl_balance - $nol , sl_taken = sl_taken + $nol where user_id = '$myname'";
}
}
else if ($leavetype == 'CL') {
$nol=$_POST["nol"];

$query9 = "update emp_leave_status set cl_taken = cl_taken + $nol where user_id = '$myname'";

}
mysql_query($query9);
@mysql_query($query10);

}
$_SESSION['leavetype']=$_POST['leavetype'];
$_SESSION['nol']=$_POST["nol"];
$_SESSION['start_date']=$_POST["start_date"];
$_SESSION['end_date']=$_POST["end_date"];
$_SESSION['reason']=$_POST["reason"];
header("Location:http://localhost/Mysql/Intranetportal/website/apply_leave-thanks.php");
}
?>


These two alert box not working when condition true but it redirect to other page.

echo "<script> alert('Unsufficient PL leave,Remaining Leave will be add in CL');</script>";
echo "<script> alert('Unsufficient SL leave ,Remaining Leave will be add in CL');</script>";


what should i do?
Any suggestion.

thanks

解决方案

_SESSION["user_name"])) { header("Location:http://localhost/Mysql/Intranetportal/"); } include ("../dbconfig.php");


myname=


_SESSION["user_name"];


这篇关于回声java脚本无法正常工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆