Hi All,
I’m trying to send my visitors back to the page they just came from but also passing a variable back to it.
There are two pages: one is the form, the second is the form action. The form action has the refresh tag and the url in the refresh tag goes like this:
<?
$g_id = $_GET['g_id'];
print '<meta http-equiv="refresh" content="5;URL=Edit_Gallery.php?g_id=$g_id">
<title>The image has been deleted</title>
<link href="../_stylesheet.css" rel="stylesheet" type="text/css">
</head>';
?>
It will only print that if a databse mod is successful, here is the full form action:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<?
$image_id = $_GET['image_id'];
$g_id = $_GET['g_id'];
$image_target = $_GET['image_target'];
$delete = '../Gallery/'.$image_target;
//$success = unlink($delete);
$success = true;
if($success){
require '../include.php';
$sql = "DELETE FROM gallery".$g_id." WHERE image_id=$image_id;";
$result = mysql_query($sql);
if (mysql_error()){
print "Database Error: $sql " . mysql_error();
}else{
print '<meta http-equiv="refresh" content="5;URL=Edit_Gallery.php?g_id=$g_id">
<title>The image has been deleted</title>
<link href="../_stylesheet.css" rel="stylesheet" type="text/css">
</head>';
}
}else{
?>
<title>The image has not been deleted</title>
<link href="../_stylesheet.css" rel="stylesheet" type="text/css">
</head>
<table width="500" border="0" align="center" cellpadding="6" cellspacing="0">
<tr>
<td>
<?php include "_header.php"; ?>
</td>
</tr>
<tr>
<td>
<? print "<p>File not deleted.</p>
<p><a href='Edit_Gallery.php?g_id=$g_id'>Back</a></p>";
?>
</td>
</tr>
</table>
<?
}
mysql_close();
?>
</body>
</html>
Problem: it goes back to the right page but the variable in the url stays as “$g_id”. The variable exists in the action page because I can print it and the database mod is successful. But why is the variable not appearing in the url?
Thanks
C