我想在php页面上安装简单的加载器。
阶段:
1.首先,我通过表单提交将文件数据发布到另一个php页面abc.php
。
2. abc.php
执行查询会花费很多时间,因为文件中的每个记录都有一个condition
3.根据条件循环插入数据。每个记录可能满足不同的条件。
4. php页面以SESSION
开头。
当我在示例文件中运行简单代码时。 该代码将顺利运行。但不能在php页面上执行。 示例文件代码为-
<div id="overlay"></div><iframe src="abc.php">>Your browser does not support iframes.</p></iframe>
css-
#overlay{
width: 100%;
height: 100%;
background-color: gray;
position: fixed;
margin: -0.7%;
opacity: 0.6
}
,最后一个脚本为-
var ol = document.getElementById("overlay"); window.addEventListener("load", function(){ ol.style.display="none"; });
此代码是可执行的。但不适用于php文件。 想要在提交表单后执行abc.php时运行此代码。
ImportMain.php包含表格-
<form id="upload_csv" method="post" enctype="multipart/form-data" action="abc.php" onsubmit="return Validate()" name="myform">
<div id="File">
<div><h4 STYLE="TEXT-ALIGN: CENTER; COLOR: brown;">IMPORT FILE</h4></div>
<!--UPLOAD FILE--------------------------------------------------------------------------------------->
<input type="file" name="uploadfile" class="fileInput">
<!--UPLOAD FILE ERROR MESSAGE------------------------------------------------------------------------->
<div id="uploadfile_error" class="val_error"></div>
<!--ADD CAMPIGN NAME---------------------------------------------------------------------------------->
<div id="CampaignSearch">
<input type="text" name="CampaignName" class="typeahead tt-query textInput"
id="search_text" placeholder="Campaign Name"
style="background: white;">
</div>
<!--EMPTY CAMPAIGN NAME ERROR MESSAGE---------------------------------------------------------------->
<div id="CampaignName_error" class="val_error"></div>
<div id="ProjectDetails">
<!--PROJECT NAME--------------------------------------------------------------------------------------->
<input type="text" name="ProjectName" class="textInput" placeholder="Project Name">
<!--PROJECT NAME ERRRO MESSAGE----------------------------------------------------------------------------------------------------------------------------------------->
<div id="ProjectName_error" class="val_error"></div>
<!--WORK ID--------------------------------------------------------------------------------------->
<input type="text" name="WorkId" class="textInput" Placeholder="WorkId"">
<!--WORK ID ERROR MESSAGE------------------------------------------------------------------------->
<div id="WorkId_error" class="val_error"></div>
<!--CLIENT NAME--------------------------------------------------------------------------------------->
<input type="text" name="ClientName" class="textInput" Placeholder="Client Name"">
<!--WORK ID ERROR MESSAGE------------------------------------------------------------------------->
<div id="ClientName_error" class="val_error"></div>
<!--CLIENT NAME--------------------------------------------------------------------------------------->
<input type="text" name="ManagerName" class="textInput" Placeholder="Manager"">
<!--WORK ID ERROR MESSAGE------------------------------------------------------------------------->
<div id="ManagerName_error" class="val_error"></div>
</div>
<!--SUBMIT BUTTON------------------------------------------------------------------------------------>
<div style="margin-left: auto; margin-right: auto; margin-top: 3px;">
<input type="submit" name="submit" value="UPLOAD" class="bn">
</div>
<!--SAMPLE CSV FORMAT-------------------------------------------------------------------------------->
<div id="csvformat">
<img src="images/csvformat.png" height="45" width="300" >
</div>
</div>
abc.php-
session_start();if(!isset($_SESSION['login_status'])){ header("Location: Main.php") ; }
/*INSERT CAMPAIGN NAME------------------------------------------------------------------------*/
$CampaignId=$_SESSION['CampaignId'];
//ECHO $CampaignId;
$Dup_Database=0;
$Q1 = "SELECT * FROM 1.Contacts where CampaignId='$CampaignId'";
$R1 = mysqli_query($conn, $Q1);
IF ($R1->num_rows > 0)
{
WHILE($ROW1=MYSQLI_FETCH_ARRAY($R1))
{
$email=$ROW1['EmailAddress'];
$Q3 = "SELECT * FROM 1.Contacts where EmailAddress='$email' AND CampaignId <> '$CampaignId' AND EmailStatus<>'SUPPRESSED' AND RPAStatus='COMPLETE' ORDER BY EvaContactid DESC; ";
$R3 = mysqli_query($conn, $Q3);
/*INSERT FOR DUPLICATE RECORDS----------*/
IF ($R3->num_rows > 0)
{
WHILE($ROW3=MYSQLI_FETCH_ARRAY($R3))
{
$EmailStatus=$ROW3['EmailStatus'];
$EmailDetails=$ROW3['EmailDetails'];
$RPADetails=$ROW3['RPADetails'];
$ErrorDetails=$ROW3['ErrorDetails'];
$PCName=$ROW3['PCName'];
$Dup=$ROW3['Dup']+1;
$SentStamp=$ROW3['SentStamp'];
$ReadStamp=$ROW3['ReadStamp'];
$ProfileId=$ROW3['ProfileId'];
$ActionDate=$ROW3['ActionDate'];
$StartTime=$ROW3['StartTime'];
$EndTIme=$ROW3['EndTIme'];
$AHT=$ROW3['AHT'];
$query = "UPDATE 1.Contacts
SET
CampaignId='$CampaignId',
empId='{$_SESSION['login_status']}',
EmailStatus='$EmailStatus',
EmailDetails='$EmailDetails',
RPAStatus='COMPLETE',
RPADetails='$RPADetails',
ErrorDetails='$ErrorDetails',
PCName='$PCName',
Dup='$Dup',
SentStamp='$SentStamp',
ReadStamp='$ReadStamp',
ProfileId='$ProfileId',
ActionDate=now(),
StartTime='$StartTime',
EndTIme='$EndTIme',
AHT='$AHT'
WHERE EmailAddress='$email' AND CampaignId = '$CampaignId' AND RPAStatus='PENDING'
";
mysqli_query($conn, $query);
$Dup_Database++;
break;
}
}else{
/*----*/
}
}
}
$Data_Remain = $Unique_Record - $Dup_Database;
$_SESSION['Data_Remain']=$Data_Remain;