Function form_open error |
[eluser]Unknown[/eluser]
Hi. I have a form and in localhost it works fine but when i put it in my linux server gives me this error in formulario_view.php. I work with PHP5 in both locations: Fatal error: Call to undefined function form_open() in /home/klaudio/public_html/ci/system/application/views/formulario_view.php on line 18 The code: 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 2 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 3 <html> 4 <head> 5 <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 6 <title>Godbit Code Igniter Tutorial: Creating a simple Registration Form</title> 7 <style type="text/css"> 8 body { 9 font: small/1.5em Verdana, Arial, Helvetica, serif; 10 } 11 </style> 12 </head> 13 <body> 14 <h1>Formulário de Registo</h1> 15 <p>Por favor complete o seguinte formulário:</p> 17 <?php echo $this->validation->error_string; ?> 18 <?php echo form_open('formulario/index'); ?> 19 <p><label for="nome">Nome: </label><br /><?php echo form_input($nome); ?></p> 20 <p><label for="email">E-mail: </label><br /><?php echo form_input($email); ?></p> 21 <p>Por favor indique um ou mais clubes que mais goste</p> 22 <p><?php echo form_checkbox($purpose); ?> <label for="purpose">Benfica</label></p> 23 <p><?php echo form_checkbox($prepare); ?> <label for="prepare">Sporting</label></p> 24 <p><?php echo form_checkbox($principles); ?> <label for="principles">Porto</label></p> 25 <p><?php echo form_checkbox($power); ?> <label for="power">Barcelona</label></p> 26 <p><label for="comentarios">Comentários: </label><br /><?php echo form_textarea 27 ($comentarios); ?></p> 28 <?php echo form_submit('submit', 'Submit'); ?> 29 <?php echo form_close(); ?> 30 </body> 31 </html> The formulario.php controller file <?php class Formulario extends Controller { function index() { # Validations $this->load->library('validation'); $this->load->library('email'); $rules['nome'] = "required"; $rules['email'] = "required|valid_email"; $this->validation->set_rules($rules); # Input and textarea field attributes $data["nome"] = array('name' => 'nome', 'id' => 'nome'); $data['email'] = array('name' => 'email', 'id' => 'email'); $data['comentarios'] = array('name' => 'comentarios', 'id' => 'comentarios', 'rows' => 3, 'cols' => 40); # Checkbox attributes $data['purpose'] = array('name' => 'seminario[]', 'id' => 'purpose', 'value' => 'Purpose of Prayer', 'checked' => FALSE); $data['prepare'] = array('name' => 'seminario[]', 'id' => 'prepare', 'value' => 'Prepare for Prayer', 'checked' => FALSE); $data['principles'] = array('name' => 'seminario[]', 'id' => 'principles', 'value' => 'Principles of Prayer', 'checked' => FALSE); $data['power'] = array('name' => 'seminario[]', 'id' => 'power', 'value' => 'Power in Prayer', 'checked' => FALSE); if ($this->validation->run() == FALSE) { $this->load->view('formulario_view', $data); } else { $nome = $this->input->post('nome'); $email = $this->input->post('email'); $comentarios = $this->input->post('comentarios'); $seminarios = ""; foreach($this->input->post('seminario') as $value){ $seminarios .= "$value\n"; } $message = "$nome ($email) would like to register for the following seminarios:\n$seminarios and had this to say:\n\n$comentarios"; $this->email->from($email, $nome); $this->email->to('[email protected]'); $this->email->subject('Registo Seminário'); $this->email->message($message); $this->email->send(); $this->load->view('formulariosucesso'); } }
|
Welcome Guest, Not a member yet? Register Sign In |