[eluser]gwerner[/eluser]
This question has been asked before, but I'm not finding anything definitive. I've created a form page that is one view for both add and edit. I'm using set_value for the input value fields. Is using isset the best way to bypass the variable if a user is accessing the add page? I've read a few examples that stated you should blank the variables before loading the view. That seems about the same as my example below, but I could be wrong.
If I don't use the isset it will throw the variable is undefined error. Which makes sense because the variable isn't set like it would be if accessing the edit page. The edit page would query the database and set the value.
I really just want to make sure I'm heading in the right direction here. I have a bunch or forms I have to create and don't want to head down the wrong path and then have to redo everything. Any isight is appreciated!
Code:
value="<?php echo set_value('userFirst', (isset($data['users_first'])) ? $data['users_first'] : '' ); ?>"