Noob, checking in view to see if a data item exists


I'm a noob in both PHP/CI, so I'm going to play my ask-one-stupid-question-free card now.

I have a view with a form with all the validation stuff in it, in one particular case I'd like to add an additional message to it.

So I have 5 calls that do

and I want to do one that does
$data['error'] = 'Its all gone a bit Pete Tong';

I reckon in my view I'd need something like
echo 'Error:'.$error;

but I guess it's not going to work like that.

Anyone point me in the right direction, I guess there must be some sort of ability to do this as I'd imagine there are a lot of cases where you'd want a view that you can send different blobs of data to and for it to be able to pick'n'choose what to display depending on what is available.

or maybe not.

Muchos gracias in advance.

If you want the additional message attached to the validation error_string you could do
$this->validation->error_string = ‘Its all gone a bit Pete Tong’;
Is it this what you are after?

[eluser]Michael Wales[/eluser]
Using the code example you provided, you would change your view code to:

  echo 'Error:' . $error;


that did the job, my lack of knowledge of php showing there a bit. Still it's quite impressive how much I can do in CI with next to no php skillz.



All of us started knowing jack shait on PHP, so just keep up the good work Smile

Yes, CI is great in many ways.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.