CodeIgniter Forums
div display problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: div display problem (/showthread.php?tid=18056)



div display problem - El Forum - 04-24-2009

[eluser]rajyakshmik[/eluser]
Hi,
I have two div's .after clicking one button, one div will open.within first div i m giving name and email address and i m submitting the form.After submitting the form i need to display second div based on my form action.
Now my problem is it's going to controller but second div content is displaying ...Please help me on this..


div display problem - El Forum - 04-24-2009

[eluser]Thorpe Obazee[/eluser]
Please show us some code and please explain the problem better.


div display problem - El Forum - 04-24-2009

[eluser]rajyakshmik[/eluser]
My problem is resolved.thanks for ur reply


div display problem - El Forum - 04-24-2009

[eluser]Freshinc.Olly[/eluser]
In your controller you can have some process measures to check if the data is valid. For this, check out the Form Validation class.

Essencially if no other data is being passed to your view, you could simply pass a boolean variable inidcating whether or not to show the div.

Code:
$data['form_success'] = true;
$this->load->view('login', $data);

or if the form failed.

Code:
$data['form_success'] = false;
$this->load->view('login', $data);

then in your view you will need to have code to read this variable to either show or hide the div. You can do so by the following:

Code:
<div class="Message" style="visibility: &lt;?= ($data['form_success'] ? 'hidden' : 'visible'); ?&gt;;" >
The process completed successfully
</div>