<html>
<! TestHereDoc.php                                            >
<! Chapter 3, Oracle Database XE PHP Web Programming          >
<! by Michael McLaughlin                                      >
<!                                                            >
<! This script demonstrates PHP here document print()         >
<! construct.                                                 >
<head>
<meta http-equiv=Content-Type content=text/html;
      http-equiv=Content-Script-Type text/javascript charset=iso-8859-1>
<title>
  Test HereDoc Utility
</title>
</head>
<body>
<?php
// Use the heredoc syntax to put a set of things into a web page.
print <<<HERE
  <script>
    function checkText(source,button,e)
    {
      // If e is true check it or assign window.event.
      e = (e) ? e : event;

      // Convert event value to a number.
      var charCode = (e.charCode) ? e.charCode :
                    ((e.keyCode) ? e.keyCode :
                    ((e.which) ? e.which : 0));

      // Enable the reset button if a character entry.
      if (charCode > 31)
        document.getElementById(button).disabled = false;
      else
        document.getElementById(source.id).value = "";

      // Return true.
      return true;
    }

    // Define client side JavaScript resetText function.
    function resetText(buttonId,elementId)
    {
      // Reset text to null value.
      document.getElementById(elementId).value = "";

      // Disable button.
      document.getElementById(buttonId).disabled = true;
    }
  </script>
  <form id="sampleForm">
  Enter Text:
  <input type="text"
         id="text"
         onkeypress="return checkText(this,'reset',event)"><br>
  <input type="button"
         disabled="true"
         id="reset"
         value="Reset Text"
		 onclick="resetText(this.id,text.id);">
  </form>
HERE;

?>
</body>
</html>