Hello,
I'm not sure what the best way to handle what I need to do. I'm receiving a javascript error when I execute the code below.
From what guys on the javascript forum tell me, either I need to generate the script conditionally the same way I do the form, or add the correct checking in the script to make sure the form is there before calling methods on it.
Does anyone have any ideas on how to change the following code to accomplish this? I'm not sure whether to change the javascript or the php code.
Thanks very much for the help,
Gary
<html>
<head>
<SCRIPT LANGUAGE="JavaScript"><!--
setTimeout('document.uploadimage.submit()',2000); // 1000 = 1 sec
setTimeout('document.replaceimage.submit()',2000); // 1000 = 1 sec
//--></SCRIPT>
</head>
<body>
<?php
.
.
.
$query = "SELECT * FROM agents WHERE id = $agent_id";
$result = mysql_query($query) or die ("Can't connect [ 001 ] because ".mysql_error());
if (!$result)
echo " AGENT Information Not Found ";
else
while ($row = mysql_fetch_assoc($result)) {
$agent_image = $row["agent_image"];
}
if ($agent_image == "")
echo "<form action=\"http://www.hintsforhomes.com/agent_upload_image.php\" method=\"post\" name=\"uploadimage\">
<input type=\"hidden\" name=\"agent_id\" value=$agent_id <REDIRECTING TO UPLOAD IMAGE PAGE></form>";
else
echo "<form action=\"http://www.hintsforhomes.com/upload_agent_image_7102947205_6119043877_22990032345/index.php\" method=\"post\" name=\"replaceimage\">
<input type=\"hidden\" name=\"agent_id\" value=$agent_id <REDIRECTING TO REPLACE IMAGE PAGE></form>";
?>
</body>
</html>