Welcome Guest, Not a member yet? Register   Sign In
Array values that arent set
#1

[eluser]a.somervell[/eluser]
Heya, anyone got an intelligent answer to this, its escaping me:

I'm doing a simple profile management form for an account

In my form i've got

Code:
<input type="text" name="first_name" value="<?=set_value("first_name",$account['first_name'])?>" />

first_name is obviously the field name (and database field name), if I don't see a post I grab the defaults from the database and pass the row_array() to the $account variable in the view.

If someone goes in and theres no first_name in the database $account['first_name'] isn't set and I get a php notice that it is undefined.

Now, I could ignore notices or go...

Code:
$account['first_name'] = (isset($account['first_name']) ? $account['first_name'] : "";

... for every bloody line, but i'd rather just have a simple solution and there's *gotta* be one in PHP I just dont know about?


Messages In This Thread
Array values that arent set - by El Forum - 05-15-2009, 11:12 PM
Array values that arent set - by El Forum - 05-16-2009, 01:21 AM
Array values that arent set - by El Forum - 05-16-2009, 04:14 AM
Array values that arent set - by El Forum - 05-16-2009, 05:55 AM
Array values that arent set - by El Forum - 05-16-2009, 06:36 PM
Array values that arent set - by El Forum - 05-16-2009, 11:21 PM
Array values that arent set - by El Forum - 05-16-2009, 11:40 PM
Array values that arent set - by El Forum - 05-17-2009, 03:32 AM
Array values that arent set - by El Forum - 05-17-2009, 05:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB