Welcome Guest, Not a member yet? Register   Sign In
Advice on doing this better, faster and neater (form and image upload)
#5

[eluser]Référencement Google[/eluser]
You also can group the validation strings into a variable while it's repetitive, that would make something like this:

Code:
// validation area
$vstring = "trim|required|xss_clean";

$rules['title'] = $vstring;
$rules['tag'] = $vstring;
$rules['dscpn'] = $vstring;
$rules['text'] = $vstring;

Also, I just don't like to code like that, but I think it would even be possible to make:

Code:
$vstring = "trim|required|xss_clean";
$rules['title'] = $rules['tag'] = $rules['dscpn'] = $rules['text'] = $vstring;

And even:
Code:
$vstring = "trim|required|xss_clean";
$rules = array('title', 'tag', 'dscpn', 'text') = $vstring; // Not tested though...


Messages In This Thread
Advice on doing this better, faster and neater (form and image upload) - by El Forum - 05-14-2008, 08:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB