I need help with the javascript syntax.
I’m using a javascript to call a php page. the php looks up some db choices and passes the output back to the html page.
Originally, the php output was a simple link and it worked fine.
Now, I’m trying to make that output a little more complicated and it fails.
The php generates the code I want (I’ve checked it as a standalone) but when passing back to the html page it fails as an unterminated string constant.
productpage.htm:
<SCRIPT LANGUAGE=”JavaScript” type=”text/javascript” SRC=”lookup2a.php?prodName=Bar F Bell Boots B250″>
</SCRIPT>
lookup2a.php:
some code….
?>
<!–
document.write(“<?php echo $cartlink; ?>”);
//–>
the $cartlink produces good html code:
<form method=’POST’ action=’cart3.php’>
<input type=’hidden’ name=’action’ value=’add_item’>
<input type=’hidden’ name=’prodId’ value=’286′>
<input type=’hidden’ name=’qty’ value=’1′>
<br>Available Sizes:<br>
<select name=’size’ size=’1′><option value=’large’>large<option value=’medium’>medium<option value=’small’>small</select>
<br>Available colors:<br>
<select name=’color’ color=’1′><option value=’Black’>Black<option value=’Burgundy’>Burgundy<option value=’Hunter Green’>Hunter Green<option value=’Lavender’>Lavender<option value=’Navy Blue’>Navy Blue<option value=’Neon Green’>Neon Green<option value=’Neon Pink’>Neon Pink<option value=’Pink’>Pink<option value=’Purple’>Purple<option value=’Red’>Red<option value=’Royal Blue’>Royal Blue<option value=’Silver’>Silver<option value=’Turquiose’>Turquiose<option value=’White’>White</select>
<br><input type=’Submit’ value=’Add Bar F Bell Boots B250 to Shopping Cart’></form><br>
BUT,
within the produt.htm page, I get the error:
unterminated string literal
and it points to the document.write(” spot.
I’ve tried various combinations of quotes, single quotes, and no quotes, but haven’t found the right combination.
Anybody know the right combo for this?
Thanks