Welcome Guest, Not a member yet? Register   Sign In
View loses its CSS and doesn't respond to controllers
#1

[eluser]X47X[/eluser]
Hi first of all sorry for my english.

I have been doing an application where i have a home page and when i click to a submit button to go to another page in this case register user.

It does go to the controller and shows me the view, but in the redirected page it loses the CSS style and when i fill in the fields and click the button it redirects me to the homepage without doing anything. And when i run independently the user controller in which i have the form with validations and the insertion to the database it runs correctly.

Here is some code of how do i redirect clicking the button.

<h1>Register as Applicant</h1>
<a class="whyus" href="#">Register as Applicant</a>
<p><a>If you register as Applicant you will be able to publish your resume in your profile and view profiles of companies related to your interests.</a><br /><br />
<a href="index.php/user" class="button"><span>Register</span>



</a></p>


Thanks.
#2

[eluser]R_Nelson[/eluser]
can you post the redirect and maybe the function your redirecting to?
#3

[eluser]X47X[/eluser]
This is the function register which calls to the view_register

function register(){

$this->load->library('form_validation');

$this->form_validation->set_rules('username', 'Username','trim|required|alphanumeric|min_length[6]|xss_clean|strtolower|callback_username_not_exists');
$this->form_validation->set_rules('name', 'Name','trim|required|alphanumeric|min_length[6]');
$this->form_validation->set_rules('email', 'Email Address','trim|required|min_length[6]|xss_clean|valid_email');
$this->form_validation->set_rules('password', 'Password','trim|required|alphanumeric|min_length[6]|xss_clean');
$this->form_validation->set_rules('password_conf', 'Password Confirmation','trim|required|alphanumeric|min_length[6]|matches[password]|xss_clean');


if($this->form_validation->run() == FALSE){
//hasn't been run or there are validation errors
$this->load->view('view_register', $this->view_data);

}else{
//no problems like validation errors and stuff
$name = $this->input->post('name');
$username = $this->input->post('username');
$password = $this->input->post('password');
$address = $this->input->post('address');
$email = $this->input->post('email');
$activation_code = $this->_random_string(10);
$this->User_model->register_user($name, $username, $password, $address, $email, $activation_code);

}
}


and i go to it trou' the
<a href="index.php/user" class="button"><span>Register</span>
#4

[eluser]R_Nelson[/eluser]
i think what you need to do is send it to the function that would load that view

like $this->function_name_here()

then it should send that data

hope that helps
#5

[eluser]X47X[/eluser]
for instance

&lt;?php $this->register() ?&gt;

where do i put that? in the view of my home? @.@ or u want me to stop using the a href='path'
cuz i used what i put at first and gives an error


Register
Fatal error: Call to undefined method CI_Loader::register() in C:\xampp\htdocs\Laborari\application\views\view_home.php

I must say that im on a view and i want to call a controller, i succeded by the
a href='path'
but the form of the register_view called by the user controller does not works as it should

u.u
#6

[eluser]R_Nelson[/eluser]
in your controller
#7

[eluser]X47X[/eluser]
oh yes i have this:

function index(){
$this->register();
}
#8

[eluser]InsiteFX[/eluser]
What you need to do is create a seperate header_view that contains all your header information and include that in all your view files at the top!

application/views/template.php
Code:
&lt;?php $this->load->view('header_view'); ?&gt;

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

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

InsiteFX
#9

[eluser]X47X[/eluser]
Ok now everthing's cool thank so much guys.




Theme © iAndrew 2016 - Forum software by © MyBB