validation script not working on Include
Posted: Thu Jun 14, 2012 11:20 am
Hi, I think I need help with this.
Once I had a php in which a validation script for a form worked ok.
It looked something like this:
As I said, form validation here was OK.
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:
Header.php:
WhereFormIs.php:
I thought that "including" several pieces of code work as a whole (for example, link to CSS is in the "Header.php", and is correctly assigned to the others pieces conforming the page).
My question is:
Is this last concept correct?
Thanks in advance.
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.