Once I had a php in which a validation script for a form worked ok.
It looked something like this:
Code: Select all
<head>
<script>
function checkform()
{
if (something) {
return true;
}
}
</script>
</head>
<body>
<form name="xx" form action="xx.php" method="post" onSubmit="return checkform()">
here form stuff
</form>
</body>
Now I changed the rationale of the page, and the validation script is in a file separeted from the Form, and I joint this two files with the "include" statement. This operation is performed by the Handler.php. Something like this:
Handler.php:
Code: Select all
<?php
if (something) {
include 'Header.php';
include 'WhereFormIs.php';
}
?>
Code: Select all
<head>
<script>
function checkform()
{
if (something) {
return true;
}
</script>
</head>
Code: Select all
<body>
<form name="xx" form action="xx.php" method="post" onSubmit="return checkform()">
here form stuff
</form>
</body>
My question is:
Is this last concept correct?
Thanks in advance.