Hi. I am new to creating websites, so please excuse my ignorance.
I have a form containing two thumbnails. I have used the Onclick(pict) to call a function which should send the value pict to a new page but it doesn't work.
The idea is that the second page will look up the image details in a csv file and display the full size picture in the new form. This means that I don't have to have a different html page for each image.
This is my first form:
<html>
<head>
<title>OnClick</title>
</head>
<body>
<form name = "Form1"
action = "ShowImage.php"
method = "post">
</form>
<script type = "text/javascript">
//<![CDATA[
var pict = 0;
function func1(pict)
{
alert("picture " + pict);
document.Form1.submit();
}
//]]>
</script>
<p><img src="DSCF1668.jpg" onclick="func1(0);" style="width: 150px; height: 150px">
<img src="DSCF3116.jpg" onclick="func1(1);" style="width: 150px; height: 150px">
</p>
</body>
</html>
and my second form:
<html>
<head>
<title>ShowImage.php</title>
</head>
<body>
<?php
$Pict = $_REQUEST["pict"];
print("<h1> $Pict </h1>");
?>
</body>
</html>
Clicking on a thumbnail transfers to the new page, but I get a message:
Notice: Undefined index: pict in C:\xampp\htdocs\Bk05Ch06\ShowImage.php on line 11
How do I get the variable "pict" transferred to the new page?
Thanks.
See more:
free ringtone download |
free ringtones,
download message tones