/    Sign up×
Community /Pin to ProfileBookmark

add if statement to mail form in flash/php

I’m trying to customize this e-mail flash form:

[url]http://www.kirupa.com/developer/actionscript/flash_php_email.htm[/url]

Problem: I wanna add a text field called ‘confirm email’ and with a php if statement make a condition to check that the content of ’email’ field is the same than the ‘confirm email’ field.

I know how to add field in Flash and so on. Question is how to add if condition to PHP,

Mails from the flash file are sent using this php file that contains this code:

[code=php]<?php

$sendTo = “[email protected]”;
$subject = “My Flash site reply”;

$headers = “From: ” . $_POST[“firstName”] .” “. $_POST[“lastname”] . “<” . $_POST[“email”] .”>rn”;

$headers .= “Reply-To: ” . $_POST[“email”] . “rn”;
$headers .= “Return-path: ” . $_POST[“email”];

$message = $_POST[“message”];
mail($sendTo, $subject, $message, $headers);

?>[/code]

Thanks

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@criterion9Sep 14.2009 — If your new field is going to be "confirm_email" then if($_POST['email'] == $_POST['confirm_email']) should work for you.
Copy linkTweet thisAlerts:
@alexthecattaauthorSep 20.2009 — thanks for ur reply.

So the PHP file would be this way:
[code=php]<?php

$sendTo = "[email protected]";
$subject = "My Flash site reply";

$headers = "From: " . $_POST["firstName"] ." ". $_POST["lastname"] . "<" . $_POST["email"] .">rn";

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

if($_POST['email'] == $_POST['confirm_email']);

$message = $_POST["message"];
mail($sendTo, $subject, $message, $headers);

?>[/code]


am I right?

And how to make the 'else' condition that allows me to display in the Flash file something like "Error, you've entered an invalid e-mail address" in case the two text field are not the same?
Copy linkTweet thisAlerts:
@criterion9Sep 20.2009 — Read up on if statements. You could also see else statements too.
×

Success!

Help @alexthecatta spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...