When I try to use this code on a php page it picks up <?php in the script thinking im going to use some php. How can I work around this? If you want the link to the page PM me for it. This script sends the following info to a textarea.
Code:
<script language="JavaScript">
/* Create the dataset and write to textarea */
function build_it_functions(form) {
/# Primary Variable */
functionsWizard=""
functionsWizard += "<?php\n\n"
functionsWizard += "// FILENAME: FUNCTIONS.INC.PHP\n"
functionsWizard += "function send_error_email( $error_code='Undefined' )\n\n"
functionsWizard += "{\n"
functionsWizard += " // set the TO: email address\n"
functionsWizard += " $to = '" + form.mailAddress.value + "';\n\n"
functionsWizard += " // set the SUBJECT: e-mail\n"
functionsWizard += " $subject = \"An error has occured - type: $error_code\";\n\n"
functionsWizard += " // set the MESSAGE: e-mail\n"
functionsWizard += " $message = \"The following error has occured:\\r\\n\"\n\n"
functionsWizard += " .\"--------------------------------\\r\\n\\r\\n\"\n"
functionsWizard += " .\" Type: $error_code\\r\\n\"\n"
functionsWizard += " .\" Page: {$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}\\r\\n\"\n"
functionsWizard += " .\" Time: \".date('d/m/Y H:i:s').\"\\r\\n\"\n"
functionsWizard += " .\" From IP: {$_SERVER['REMOTE_ADDR']}\\r\\n\\r\\n\"\n"
functionsWizard += " .\"Regards,\\r\\n\"\n"
functionsWizard += " .\"Your hard-working web server.\";\n\n"
functionsWizard += " $headers = \"From: webserver@{$_SERVER['SERVER_NAME']}\\n\"\n"
functionsWizard += " .\"Reply-To: webserver@{$_SERVER['SERVER_NAME']}\\n\"\n"
functionsWizard += " .\"X-Mailer: PHP/\".phpversion();\n\n"
functionsWizard += " // send the email\n"
functionsWizard += " mail( $to, $subject, $message, $headers );\n"
functionsWizard += "}\n\n"
functionsWizard += "?>"
/* Build It */
document.functionsWizard1.bundle_it_functions.value='<!-- Generator Coded by\: WWW\.************\.COM\, Script by *** -->\n<!-- Begin PHP Code -->\n\n' + functionsWizard + '\n<!-- End PHP Code -->'
}
</script>
Thanks