Hi,
I am trying to get a php variable into a header, I have managed it in another file but it not having it this time and I do not know why.
Here is my php code
<?php
header("Location: photo.php?albumid=".urlencode($albumid));
include_once 'title.php';
$result = mysql_query("SELECT id FROM user WHERE user='$user'");
$id = mysql_result($result, 0);
if (isset($_POST['album']))
{
$album = sanitizeString($_POST['album']);
$result = mysql_query("INSERT INTO album (id, user, name) VALUES (NULL, '$id', '$album')");
}
else
{
echo "<br /><br />";
echo "Error: Please enter an album name";
}
$sql = "SELECT id FROM album WHERE name='$album'";
$result = mysql_query("$sql") or die("Invalid query: " . mysql_error());
$albumid = mysql_result($result, 0);
echo $albumid; // correctly displays the album's id
?>
When this page is run and the header redirects the user the url is shown as:
photo.php?albumid=
rather than for example:
photo.php?albumid=3
Hope someone can help me fix this.
Thanks.