Welcome Guest, Not a member yet? Register   Sign In
Edit, validate, re-edit issue using set_value with optional parameter
#1

[eluser]billmce[/eluser]
Maybe I'm just missing something simple ... but I've spent hours and hours on this.

I can retrieve data (in this example using $data['Company'] )from mysql and use it to populate a view:

<input type="text" name="Company" value="<?php echo $Company; ?>" />

After loading the form_validation library, I can then validate the data on the form that the user modified and if I find an error force a re-edit and re-displaying the data:

<input type="text" name="Company" value="<?php echo set_value('Company'); ?>" />

But doing this requires me to maintain two forms -- one for the first edit, and another for subsequent edits.

After checking out set_value I thought I'd found the answer.
<input type="text" name="Company" value="<?php echo set_value('Company',$Company); ?>" />

but I get strange results after a validation failure (here entering data "Test Company Name"):

The input box is filled with <div style= followed by.

A PHP Error was encountered

Severity: Notice

Message: Undefined variable: Company

Filename: views/creditor_edit_view.php

Line Number: 57
Test Company Name" />


Any ideas on why the set_value option problem?

I'm completely stumped and frustrated.

Surely I don't need 2 forms to edit/validate/re-edit?


Messages In This Thread
Edit, validate, re-edit issue using set_value with optional parameter - by El Forum - 03-18-2010, 08:41 PM



Theme © iAndrew 2016 - Forum software by © MyBB