Unterminated String Literal In Javascript Code And Am Not Sure About Php Code Either
I have an error in the following code which says UNTERMINATED STRING LITERAL please help me and also tell me php code is on right place because it is before script tag so how can c
Solution 1:
i have question as you mentioned in comment why u need php to do that
<formaction="yea.php"method="post"><selectname="page"onchange="hitme(this);"><optionvalue="home">home</option><optionvalue="about">about</option><optionvalue="menu">menu</option><optionvalue="download">download</option></select><spanid="pagename"></span></form><script>functionhitme(page)
{
switch(page.value)
{
case"home":
document.getElementById("pagename").innerHTML = "you selected home";
break;
case"menu":
document.getElementById("pagename").innerHTML = "you selected menu";
break;
case"about":
document.getElementById("pagename").innerHTML = "you selected about";
break;
default:
document.getElementById("pagename").innerHTML = "invalid selection!";
}
}
alert("<br>it will print no matter what!");
</script></body>
Solution 2:
change your php code as
<?phpif(isset($_REQUEST['page']))
{
$page=$_REQUEST['page'];
}
else$page="";
?>
Post a Comment for "Unterminated String Literal In Javascript Code And Am Not Sure About Php Code Either"