Welcome Guest, Not a member yet? Register   Sign In
form validation where form vars are an array
#1

[eluser]Unknown[/eluser]
In my form I have named my inputs as so:
<input type="text" name="guest[first_name]" />
<input type="text" name="guest[last_name]" />
<input type="text" name="guest[email]" />

With the validation library, they say to define fields like:
$rules['first_name'] = "required";
$rules['last_name'] = "required";
$rules['email'] = "required";

So the problem is that when it goes to validate, it's expecting to find $_POST['first_name'], etc.

So my question is, is there syntax to define a field where it is in a form array? (e.g. name="guest[first_name]").
I've tried:
$rules['guest[first_name]'] = "required";
$rules['guest']['first_name'] = "required";
...and neither worked.

Any help appreciated!


Messages In This Thread
form validation where form vars are an array - by El Forum - 10-01-2008, 09:52 AM
form validation where form vars are an array - by El Forum - 10-01-2008, 11:56 AM
form validation where form vars are an array - by El Forum - 10-01-2008, 12:18 PM



Theme © iAndrew 2016 - Forum software by © MyBB