Jump to content


Photo

Java popup scripts not working in my with my php. Help!


  • Please log in to reply
3 replies to this topic

#1 zachishi

zachishi
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 01 September 2006 - 06:14 PM

I am trying to get a popup to work with this script. I have tryed numerous javascripts and nothing seems to work. Any suggestions would be great i am really not an expert with php. We have a guy working on our site that built all this and now he is gone and I am left picking up the pieces. Thanks

<?php
		$count=0;
		for($i=1;$i<=$rows;$i++) {
			print("<tr>");
			for($j=1;$j<=3;$j++) {
				if($count<$image_count) {
					if (isset($allrows[$count]['thumb']) && strlen($allrows[$count]['thumb']) > 3) {
						$prop_image1 = $allrows[$count]['thumb'];
						$prop_image = '<img src="' . $prop_image1 . '" border="0"   width="125" height="94">';
					} else {
						$prop_image = '<img src="' . APP_URL . 'images/no-pic.gif" border="0"   width="125" height="94">';
					} 
					$pname = $allrows[$count]['pname'];
					$sleep = $allrows[$count]['sleep'];
					$id = $allrows[$count]['id'];
					$output='<a href="view-property.php?id='.$id.'" target="new">'.$prop_image.'</a><br>
					<a href="view-property.php?id='.$id.'" target="new">
					<font size="2"><b>Eagles Ridge<BR>'.$pname.'</b></font></a>
					<font size="2"><b><br>'.$sleep.'</b></font>';
					print("<td align='center'>$output</td>");
				}
				else {
					print("<td>&nbsp;</td>");
				}
				$count++;
			}
			print("</tr>");
		}
	?>


#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 01 September 2006 - 06:22 PM

I see no javascript code in the code provided that atempts to create a popup. Or do you mean you want a new browser window/tab to appear when the user click the link? If so use _blank in the target attribute in your links. So use this:
$output='<a href="view-property.php?id='.$id.'" target="_blank">'.$prop_image.'</a><br>


#3 zachishi

zachishi
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 01 September 2006 - 08:20 PM

no i have entered javascript in there and it crashes the page. I was wondering if there where any suggestions for ones that play well with that php code. Cause i cannot find any. Thanks

#4 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 01 September 2006 - 10:05 PM

How are you putting the javascript in. When you put the javascript in use Heredoc syntax, or make sure you are escaping your quotes. Using HEREDOC saves you from escaping your quotes: eg:
echo <<<JSCRIPT
 -- your javascript code here --
JSCRIPT;
// DO NOT INDENT ABOVE LINE OR PUT ANYTHING ELSE ON IT, As it'll result in a fatal error.

Also when ever you are ouputting anything to the browser make sure you put in an echo statement.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users