Hi,
Javascript doesn't work if i do this way. How can i solve it? Is that because i echo it.
Thanks

<?php 
echo "<html><head>
<link type=\"text/css\" rel=\"stylesheet\" href=\"cssFile.css\" />
<script type=\"text/javascript\" src=\"javascriptFile.js\"></script>
</head><body>"; 
?>
<form name="form" action="added.php" method="post" onsubmit="return validateForm();" style="float:left">
<input type="text" name="ID" size="20" tabindex="1" />
<input type="submit" name="submitButton" value="ADD" tabindex="5" />
<?php 
echo "</body></html>"; 
?>

Recommended Answers

All 4 Replies

Hi,
Javascript doesn't work if i do this way. How can i solve it? Is that because i echo it.
Thanks

<?php 
echo "<html><head>
<link type=\"text/css\" rel=\"stylesheet\" href=\"cssFile.css\" />
<script type=\"text/javascript\" src=\"javascriptFile.js\"></script>
</head><body>"; 
?>
<form name="form" action="added.php" method="post" onsubmit="return validateForm();" style="float:left">
<input type="text" name="ID" size="20" tabindex="1" />
<input type="submit" name="submitButton" value="ADD" tabindex="5" />
<?php 
echo "</body></html>"; 
?>

Remove all you \" just keep it normal or copy and paste this code.

<?php

$str = <<<DANIWEB
<html><head>
<link type="text/css" rel="stylesheet" href="cssFile.css" />
<script type="text/javascript" src="javascriptFile.js"></script>
</head><body> 
<form name="form" action="added.php" method="post" onsubmit="return validateForm();" style="float:left">
<input type="text" name="ID" size="20" tabindex="1" />
<input type="submit" name="submitButton" value="ADD" tabindex="5" />
</body></html> 

DANIWEB;

echo $str;

?>

Sorry gusy i have noticed that i had two same named forms. I have changed one and it works now.
solved

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.