![]() |
How do you handle forms?
I'm curious how you handle submitted forms.
Like, do you just do static handling like $szName = $_POST['name']; or do you check all fields in a loop, or..?And if you do, how do you send forms to your email-inbox? Just curious :) Oh, me myself.. I do it mostly the static way :) |
I normally use a static method. For example I may have:
PHP Code:
|
Yeah, I always use mysql_real_escape_string when inserting submitted data into a database.
But my question was more how to process submitted forms, not how to secure them. ;) |
PHP Code:
To send the thing to your email, just make a text, insert the post variables where needed and send that msg. Check this code to how send mails: Gaming With PHP Blog Archive Send mails even to hotmail boxes |
You should read TalkPHP - Sending Emails with the Zend Framework for sending emails :)
|
PHP Code:
|
I played a abit with it, this is also a way I came up with:
PHP Code:
$aForm array. So when you want to echo the fields just do echo $aForm['name'];. Easy as that. |
I use Inspekt for all my superglobals :)
Just make a POST cage and assign values PHP Code:
|
:)
PHP Code:
|
There is such a thing of reinventing the wheel you know. :-P
|
Nor, surely
$_POST['postname']; is shorter than getPost("postname"); ?Edit: Ahh, just thought; do you clean the input in the getPost function as well? |
PHP Code:
|
Quote:
Code:
function getPost($string) |
Quote:
Easiest way to go through and escape all of the input/post values. |
| All times are GMT. The time now is 04:29 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0