I have a form where users can save activity of the day, with date and time.(index.php). I have build a jquery that opens a dialog popup window on page load...I want to include this code in my second php page. This page is called add.php. the user go there when he press a submit button in page index.php. When he press the submit button, to add an activity and exist an activity in that time and date I want to show a popup. But how can I include the popup below in the add.php.
My code is below
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js" type="text/javascript"></script>
<link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/themes/start/jquery-ui.css"
rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(function () {
$("#dialog").dialog({
title: "jQuery Dialog Popup",
buttons: {
Close: function () {
$(this).dialog('close');
}
}
});
});
</script>
<div id="dialog" style="display: none">
You have an activity on this time
</div>
And this is add.php
<?php
$con = mysql_connect('127.0.0.1','root','');
if (!$con)
{
die('<div class="content">Lidhja me databazen nuk mund te kryhet</div>' .mysql_error(). ' </body></html>');
}
if(!mysql_select_db("Axhenda",$con))
die('<div class="content">Nuk mund te hapet databaza Axhenda</div>'.mysql_error(). '</body></html>');
$Data=$_POST['date'];
$Ora=$_POST['time'];
$Emri=$_POST['emritakimit'];
$Pershkrimi=$_POST['pershkrimi'];
session_start();
if (!isset($_SESSION['user_id'])){
header('location:index.php');
}
//variabli SESSION per te ruajtur ID e perdoruesit
$perdoruesi=$_SESSION['user_id'];
$selekto=mysql_query("SELECT * FROM aktiviteti WHERE Data='$Data' and Ora='$Ora'");
$nr_rreshtave=mysql_num_rows($selekto);
if ($nr_rreshtave>0)
{
//here I want to include the function above
header('locationindex.php');}
else
{
$query ="INSERT into aktiviteti VALUES('', '$perdoruesi', '$Emri', '$Pershkrimi' ,'$Data','$Ora')";
$result=mysql_query($query,$con);
if($result)
{ header('location:index.php?error-akt1=1');}
else
{ header('location:index.php?error-akt2=1');}}
mysql_close($con);
?>
please help me...Thanks in advance