logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > PHP
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 07-12-2011, 09:42 PM   #1
student101
 
Join Date: Dec 2007
Posts: 379
Question best way to trim(stripslashes( each posted form item?

Instead of mulitple of these:
PHP Code:
trim(stripslashes($_POST['item']));
trim(stripslashes($_POST['item1']));
trim(stripslashes($_POST['item2'])); 
I could use something like this:
PHP Code:
function cleanposteditems(){ 
    foreach (
$_POST as $item => $val
        
$_POST[$item] = trim(stripslashes($val)); 

BUT then I lose the $_POST['item'], $_POST['item1'] n so on
__________________
Amateurs ... Built the ark.
Professionals ... Built the Titanic.
specificity [sound like spe-sifis-ity]
student101 is offline   Reply With Quote
Old 07-13-2011, 08:45 AM   #2
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,176
Default

use a function heres on i googled http://myphpform.com/validating-forms.php
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 07-13-2011, 09:38 AM   #3
student101
 
Join Date: Dec 2007
Posts: 379
Default

Yeah thanks edbr
__________________
Amateurs ... Built the ark.
Professionals ... Built the Titanic.
specificity [sound like spe-sifis-ity]
student101 is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:54 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com