Let's say after my user fills a form and clicks the submit button, I want the user redirected to the same page with the form and a jquery animation will play. The header function is there to prevent the user from refreshing the page and resubmitting the same data.
UPDATE: I've decided to use $_SESSION to record the user's session to try to get the jquery animation to play after they get redirected to the same page:
<?php
session_start();
if (isset ($_POST['submit']))
{
$connect = mysql_connect("","","") or die("Error connecting to db");
mysql_select_db("") or die("Error connecting to db");
$text = $_POST['text'];
mysql_query ("INSERT INTO header VALUES('','$text')");
$_SESSION['jq']=='a';
header('Location: header.php');
die();
}
if($_SESSION['jq']=='a') {
$_SESSION['jq']='';
echo'
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("div").hide(3000);
});
</script>';
}
?>
<html>
<head>
<style type="text/css">
#jquery {border:1px solid black;width:300px;}
</style>
</head>
<body>
<form name="header" action="header.php" method="post">
<input type="text" name="text" />
<input type="submit" name="submit" value="submit" />
</form>
<div id="jquery">this is jquery animation</div>
</body>
</html>