Hi everybody,
i'm working on a event page, and registered users can comment on the events. If they posted a comment before, they can edit that comment by clicking a link.
Once you're in that link, you can edit the title & the content. So when they press submit, the scripts checks your information and updates the database.
Now comes the strange part... my scripts redirects automatically back to the previous page, shows the $_SESSION['msg'] var and doesn't update my database.. I should normally stay on that page and not go back..
<?php
session_start();
if(!session_is_registered(username))
{
echo "<script>history.back()</script>";
}
if($_GET['id'] == '')
{
echo "<script>history.back()</script>";
}
?>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<script src="scripts/jquery-1.2.6.min.js"></script>
<link href="styleff.css" rel="stylesheet" type="text/css">
<title>Events</title>
<?php
include 'begin.php';
?>
<div id="contentpage">
<center><h1>Events</h1></center>
<?php
$id=$_GET['id'];
list($rightname) = mysql_fetch_row(mysql_query("select username from eventsresponse where id='$id'"));
if($rightname != $_SESSION['username'] && $_SESSION['rank'] < '5')
{
$_SESSION['msg']='You don\'t have the permission to do that';
echo "<script>history.back()</script>";
}
$discr=$_POST['discr'];
$discr = stripslashes($discr);
$discr = str_replace(' ',' ',$discr);
$title = $_POST['title'];
$title = stripslashes($title);
$title = str_replace(' ',' ',$title);
mysql_query("UPDATE eventsresponse SET title = '$title' WHERE id='$id'");
$_SESSION['msg']='Saved!';
?>
any help would be welcome :-\
maximeke2