PDA

View Full Version : Validation form


sandrafonso
05-08-2008, 10:12 PM
Hello,
I`ve done a form in my flash site with PHP, but I can`t validate the fields.
Can anyone help me?

Cota
05-09-2008, 01:31 AM
You're going to have to be more specific and show us some code

sandrafonso
05-09-2008, 12:05 PM
Ok, I have just the code to the forms to work, and I don`t know how can adapte the code: I have the fields inside a movieclip with the script to go next frame to the answer to the form. In the button Submit I have the action to open the PHP page: on (release) {
form.loadVariables("email.php", "POST");
}.
The php:<?php

$sendTo = "info@luzedia.com";
$subject = "newsletter_Luz e Dia";

$headers = "From:news_ " . $_POST["nome"] ." <" . $_POST["email"] .">\r\n";

$headers .= "Reply-To: " . $_POST["email"] . "\r\n";

$headers .= "Return-path: " . $_POST["email"];

$message = $_POST["email"];

mail($sendTo, $subject, $message, $headers);

?>

I really apreciate you can help me.

Cota
05-09-2008, 03:48 PM
Do you want the validation on the Flash side, or in PHP?

In Flash, you can test the length of the text field to make sure it has something, and for email validation you can check for the "@" and "."
Validate email (just look at the code ) http://www.cambodiaxp.com/flash-tutorial10-1.html

In PHP you can use the reg, ereg expressions. There are a few other functions in PHP to validate and strip out unwanted characters.