Thanks. However there seems to be another problem, when I put this form in another class validation fails. Otherwise it is fine:
in the class
<div style="border-width: 2px; border-style: solid; border-color: black; ">
<?php
include("lateForm.php");
?>
[/b]
form.php
[code]
function getDetails()
{
global $email, $fname, $lname, $id, $reason, $year, $lecturer, $strdate;
$email = $_POST['email'];
$fname = $_POST['firstName'];
$lname = $_POST['lastName'];
$id = $_POST['idNum'];
$reason = $_POST['explain'];
$year = $_POST['year'];
$lecturer = $_POST['lecturer'];
$strdate=$_POST["txtdate"];
}
if ($_POST['process'] == 1) {
$pattern = '/.*@.*\..*/';
// $year = $_POST['year'];
// $lecturer = $_POST['lecturer'];
//getDetails();
/**
*
*if email address is not fine, then redirect to next page called
*thank you.php
*
**/
if (!preg_match($pattern, $_POST['email']) > 0) {
$message = "Please enter a valid email address.";
// getDetails();
$email = $_POST['email'];
$fname = $_POST['firstName'];
$lname = $_POST['lastName'];
$id = $_POST['idNum'];
$reason = $_POST['explain'];
$year = $_POST['year'];
$lecturer = $_POST['lecturer'];
$strdate=$_POST["txtdate"];
}
When I hardcode it inside the if statement the post methods it works fine, however when I call the getdetails() method it doesn't even echo it within the if statement.
Form action:
<form action="index.php?page=information/late" method="post">
Any idea why this is not working? Cheers.