form.htm:
<FORM method="post" action="image.php">
IMAGE FOR SUNDAY<INPUT TYPE="text" Name="Image_Id">
<INPUT TYPE="submit" VALUE="Submit Form1!">
</FORM>
image.php:
<?php
if(isset($id)) {
$db = mysql_connect("localhost", "username", "password");
mysql_select_db("database",$db);
$query = "select image,filetype from image_data where id='$id'";
$result = @($query);
$data = @MYSQL_RESULT($result,0,"image");
$type = @MYSQL_RESULT($result,0,"filetype");
Header( "Content-type: $type");
echo $data;
};
?>
<html>
<head></head>
<body>
IMAGE FOR SUNDAY<img src="image.php?id=<? echo $Image_Id; ?>" width="60" height="40">
</body>
</html>
Here from form.htm I enter 1 (Image_Id) IMAGE FOR SUNDAY, and image.php reads the variable and shows the image according to it's id.BUT IF I BROWSE http://localhost/image.php IT SAYS THAT undefined variable Image_Id in line.
THAT MEANS THE Image_Id which I HAD POSTED FROM form.htm WORKS ONLY FOR THE POSTED SESSION.
MY QUESTION IS HOW COULD I MAKE SO THAT IT WOULD WRITE in image.php Image_Id(IMAGE FOR SUNDAY<img src="image.php?id=1" >).
HOPE I HAD MAKE CLEAR MY PROBLEM.