Hi, I am a novice to php, javascript. Following is a code to insert movie. I had been to http://johnhaller.com/jh/useful_stuff/obfuscate_mailto/code/php/ Seen the code there. I've infused what I need into a format like that. Need to know if this is a proper syntax at first look. If it is fine then I shall test it BRgds, kNish <?php function InsertMovie(){ $strtag = "<script language="."Javascript"." type="text/javascript".">\n"; $strtag .= "<!--\n"; $strtag .= "document.write('<a href="<?php echo $row_display_image_Recordset['filePath_2K']; ?>"');\n"; $strtag .= "document.write('target="_BLANK"');\n"; $strtag .= "document.write('<img src="<?php echo $row_display_image_Recordset['thumbnail_Path']; ?>"');\n"; $strtag .= "document.write('width=\"140\" height=\"100\" alt=\"Thumbnail Image\" /></a>') . "</noscript>"; return $strtag; } ?> PHP:
you are missin a closing tag </script> and $strTag .= "// -->\n"; but more important i am wondering what you are trying to do.
Line 5 has a <? ... ?> sequence in it. I'm almost positive you're not menaing to print brackets and question marks to the screen. For debugging syntax, uploading and viewing is a lot faster than posting to a forum. If something's wrong PHP will barf up an error message. If things don't come out looking like you thought, you can view the source on the page and see what went wrong. It's for that last reason that I like to put \n (new line) and \t when I output html strings from php. It makes it a lot easier to follow the printed code when it lines up nice. I just noticed you've done that, but I'd put \t at the start of some of those lines too, so the final page is: <script> code code </script> Code (markup): Not so important on small pages, but if your code grows huge, the indentation can make checking it much easier. Oh, and seconding the "what are you trying to do?" thing.