As per my subject line I need to change the below code.
1) Actually I want to write a time deference to be automatically calculated between Report_Date, Resolved_Date & updated in the SLA column. can you please help me with this calculation.
a) If resolved_date is not selected in the form then the value of the SLA can be Null, One resolved_date is updated it should automatically update time difference In SLA. also time should be in format (hhh:mm:ss).
2) on inserting a record it should first redirect to the page mentioned and then alert the message saying "record inserted successfully"
PHP Code:
<?php
session_start();
$host="localhost"; // Host name
$username="test"; // Mysql username
$password="1234"; // Mysql password
$db_name="testapp"; // Database name
$tbl_name="user_supp"; // Table name
$myusername = $_SESSION['myusername']; //user who updating
$con = mysql_connect("$host","$username","$password")or die("cannot connect to server");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="INSERT INTO $tbl_name( `prefix`,`Analyst`, `Email`, `Report_Date`, `Resolved_Date`, `Issue_des`, `Resolution_des`, `SLA`)
header("location:support_update.php") or die("record not inserted");
}
echo '<script language="javascript">';
echo 'alert("you have successfully added one user !" );';
echo ' window.location="support.php";';
echo '</script>';
mysql_close();
?>
Impossible. The location header is handled by the client which then ignores the body. You cannot have an alert if you are using a location. An unofficial header of Refresh: 5; url=http://site.com/page would allow you to do this as it will wait 5 seconds before it redirects. Meta headers could also be used for a similar effect. Refresh header is not a part of RFC-2616 standards though, so there is no guarantee that it will work.
That probably means that you have included another file in the above php file which also has a `session_start()` in it.
Redcoder,
I have already cleared the issue of the error but I am more concern about the blank page while alerting.....after clearing the error as well i am seeing blank page till I click OK on the alert....
Any chance first i redirect to desire page and then alert the message ?
or any other procedure of the same......
Last edited by nani_nisha06; 10-25-2012 at 12:58 PM..