I Always get an error(Error: imagesPages is not defined) when I click on the arrow(in bold) to show the next image.
But everything works fine.
Any Idea what is this error?
<html>
<head>
<title>Voir les photos</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
$Num = "0";
$id = $_GET["id"];
$iCtr = "1";
//$HTTP_GET_VARS['action']
if ($id == "")
{
$id = "1";
}
$db = mysql_connect("localhost", "Sam");
mysql_select_db("melville",$db);
$result = mysql_query("SELECT * FROM admin",$db);
$Num = mysql_num_rows($result);
if ($id > $Num)
{
$id = $Num;
}
if ($id <= 0)
{
$id = 1;
}
for($iCtr=1; $iCtr <$id; $iCtr++)
{
$myrow = mysql_fetch_array($result);
}
if($myrow = mysql_fetch_array($result))
{
echo"<p align=center>";
printf("<a href=http://www.htmlforums.com/archive/index.php/%s?id=%s><img id=IMG src=%s width=42 height=48 border=0 onClick=previousSlide(%s)>",
$_SERVER['PHP_SELF'],$id-1,"imagesPages/arrow33l.gif",$myrow["Images"]);
printf("<a href=http://www.htmlforums.com/archive/index.php/%s?id=%s><img src=imagesPages/arrow33r.gif width=42 height=48 border=0 onClick=%s></a>",
$_SERVER['PHP_SELF'],$id+1,$myrow["Images"]);
echo"</p>";
echo"<table width=200 border=1 align=center>";
printf("<tr><td><P ALIGN=center><a><IMG SRC=http://www.htmlforums.com/archive/index.php/%s BORDER=0 NAME=slide></a></P></td></tr>",
$myrow["Images"]);
echo"</table>";
}
?>
</body>
</html>how can it be "imagesPages" ??
if anything it would be $id.I know it's weird, but it's solved(probably because i erased the onclick event)
------------
Damn i'm stupid! guess what is the value I was passing to the onclick event.always quote the value in html!!
printf("<a href=http://www.htmlforums.com/archive/index.php/\"%s?id=%s\"><img src=\"imagesPages/arrow33r.gif\" width=\"42\" height=\"48\" border=\"0\" onClick=\"%s\"></a>",
$_SERVER['PHP_SELF'],$id+1,$myrow["Images"]);
But everything works fine.
Any Idea what is this error?
<html>
<head>
<title>Voir les photos</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
$Num = "0";
$id = $_GET["id"];
$iCtr = "1";
//$HTTP_GET_VARS['action']
if ($id == "")
{
$id = "1";
}
$db = mysql_connect("localhost", "Sam");
mysql_select_db("melville",$db);
$result = mysql_query("SELECT * FROM admin",$db);
$Num = mysql_num_rows($result);
if ($id > $Num)
{
$id = $Num;
}
if ($id <= 0)
{
$id = 1;
}
for($iCtr=1; $iCtr <$id; $iCtr++)
{
$myrow = mysql_fetch_array($result);
}
if($myrow = mysql_fetch_array($result))
{
echo"<p align=center>";
printf("<a href=http://www.htmlforums.com/archive/index.php/%s?id=%s><img id=IMG src=%s width=42 height=48 border=0 onClick=previousSlide(%s)>",
$_SERVER['PHP_SELF'],$id-1,"imagesPages/arrow33l.gif",$myrow["Images"]);
printf("<a href=http://www.htmlforums.com/archive/index.php/%s?id=%s><img src=imagesPages/arrow33r.gif width=42 height=48 border=0 onClick=%s></a>",
$_SERVER['PHP_SELF'],$id+1,$myrow["Images"]);
echo"</p>";
echo"<table width=200 border=1 align=center>";
printf("<tr><td><P ALIGN=center><a><IMG SRC=http://www.htmlforums.com/archive/index.php/%s BORDER=0 NAME=slide></a></P></td></tr>",
$myrow["Images"]);
echo"</table>";
}
?>
</body>
</html>how can it be "imagesPages" ??
if anything it would be $id.I know it's weird, but it's solved(probably because i erased the onclick event)
------------
Damn i'm stupid! guess what is the value I was passing to the onclick event.always quote the value in html!!
printf("<a href=http://www.htmlforums.com/archive/index.php/\"%s?id=%s\"><img src=\"imagesPages/arrow33r.gif\" width=\"42\" height=\"48\" border=\"0\" onClick=\"%s\"></a>",
$_SERVER['PHP_SELF'],$id+1,$myrow["Images"]);