/    Sign up×
Community /Pin to ProfileBookmark

form validation with formmail.php

hey everyone i am using formmail to send myself an e-mail containing all of the information about someone trying to cancel a service to my site. i was wondering if it would be possible to, before sending all of the information to formmail.php’s built in functions to pass the information through my own that i have written that does things such as make sure e-mail domain’s really exits as well as just text fields containing only numbers or letters instead of just being blank?
thanks and any help is appreciated

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@NightShift58Jan 02.2007 — As a rule, yes.

This involve doing something to the $_POST variables because as you go from a <form> to a script and on to another script, you'll end up losing the original $_POST variables along the way. To a certain extent, therefore, it will depend on your script and what it does.

You could - once your script has worked itself through the $_POST and decided that everything checked out - use cURL to "re-submit" a virtual form and have the original $_POST variables arrive at their final destination as $_POST variables once again...
Copy linkTweet thisAlerts:
@NickG21authorJan 02.2007 — would i still be posting to the formmail.php page or should i create a validation page that if everything passes through is directly redirected to formmail.php and verified there?
Copy linkTweet thisAlerts:
@NightShift58Jan 02.2007 — I don't know what your own script will be doing.

Another option would be to use your script to short-circuit the process if anything is wrong and if everything is okay, to include formmail.php, as if nothing had happened.

So, IF errors, take the user back to the form to correct whatever needs correction. And IF no errors, include formmail.php and continue processing transparently.
Copy linkTweet thisAlerts:
@NickG21authorJan 02.2007 — i think i got it, thank you for your help
Copy linkTweet thisAlerts:
@NightShift58Jan 02.2007 — You're welcome...
×

Success!

Help @NickG21 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 5.18,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...