Quote:
Originally Posted by Guezala
Excellent.... how did u do that? I have been trying it on my site too but not werking :P
|
The reason it was working when broken into 2 pages is that the PHP side of it is kicking in before your HTML side. So when it was broken up to the 2nd page, you didn't see this part since the only time you would post to it, was when you wanted it to execute.
I added a name to your button so we can look for it later in the code so change to this:
Code:
<input type="submit" name="submit" value="Send Questionnaire!"/>
Then somewhere around line 150-160, you have the actual part of the PHP code that calls the function. You need to change it to this. This will check that the button has been clicked.
Code:
if($_POST['submit']) {
$aValidatedForm = valid_form($aVariables);
}
I also removed the check for phone syntax because it was causing too many problems, so use this new array.
Code:
$aValidationRules = array('name' => '[A-Za-z0-9\.|-|_/i]{2,20}',
'company' => '[A-Za-z0-9\.|-|_/i]{3,30}',
'address' => '[A-Za-z0-9\.|-|_/i]{3,50}',
'email' => '[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,5})');
The problem is that you don't indicate to the end user what format the phone# needs to be in, so I was trying it 3-4 different ways and it still came back as bad form. So I just took it out.
Oh and one more thing, look for this code because I commented it out too...just make sure you comment it out on your end.
Code:
#echo 'Oops: ' . $aValidatedForm['message'];