Welcome Guest, Not a member yet? Register   Sign In
Contact Form Help
#1

[eluser]dennismonsewicz[/eluser]
I am writing a contact form (complete NEWB FYI to codeigniter) but here is my code:

The Controller
Code:
function contact()
    {
        if ($this->validation->run() == FALSE)
        {
            $this->data['formPage'] = $this->load->view('form');
        }
        else
        {
            $this->data['formPage'] = $this->load->view('formsuccess');
        }
        
        $this->load->view('contact', $this->data);
            
    }

The View
Code:
<?php $this->load->view('header'); ?>

<div class="container">
                
    <div class="left_weight_two">
            
        &lt;?php $this->load->view('nav'); ?&gt;
        
        <div class="content-left">
        
        &lt;?php echo $formPage; ?&gt;
                    
             <div style="clear:both;"></div>
                                        
        </div>
                    
     </div>

&lt;?php $this->load->view('right'); ?&gt;

    <div style="clear:both;"></div>
                
</div>

&lt;?php $this->load->view('footer'); ?&gt;

For some reason the form is displaying above the header and rendering before the rest of the site. Any suggestions?
#2

[eluser]garymardell[/eluser]
$this->load->view('formsuccess');
This will automatically output that view at that moment.
You need to set a third parameter to true so it will be passed as a string i believe.

Code:
$this->load->view('formsuccess', null, true);
#3

[eluser]dennismonsewicz[/eluser]
[quote author="garymardell" date="1247871732"]$this->load->view('formsuccess');
This will automatically output that view at that moment.
You need to set a third parameter to true so it will be passed as a string i believe.

Code:
$this->load->view('formsuccess', null, true);
[/quote]

Thanks! This fixed it!




Theme © iAndrew 2016 - Forum software by © MyBB