HELP Just Installed CodeIgniter, tried to validate a contact form and getting an error message!? HELP |
[eluser]johnny916[/eluser]
My site is sealteamrealty.com I'm getting an error on my contact page so the HTML form elements won't even show up?? Fatal error: Call to undefined function validation_errors() in /home/johnny/public_html/sealteamrealty.com/application/views/contact.php on line 36 Here is the problem lines of code, the functions seems to be undefined but I've placed all the files where the Docs said to.. <?php echo validation_errors(); ?> <?php echo form_open('form'); ?> Click Contact page on my site to see what I'm talking about..
[eluser]Sudz[/eluser]
Have you loaded form_helper in your controller? Post your controller code for more clearance.
[eluser]johnny916[/eluser]
<?php class Form extends CI_Controller { function index() { $this->load->helper(array('form', 'url')); $this->load->library('form_validation'); $this->form_validation->set_rules('name', 'Name', 'required'); $this->form_validation->set_rules('email', 'Email', 'required'); if ($this->form_validation->run() == FALSE) { $this->load->view('myform'); } else { $this->load->view('formsuccess'); } } } ?>
[eluser]johnny916[/eluser]
What view? This is my contact page located in application/views/ and I named it contact.php <?php ## Contact ?> <h2>Contact</h2> <style> form#payment fieldset { border: none; margin-bottom: 10px; } form#payment fieldset:last-of-type { margin-bottom: 0; } form#payment legend { color: #384313; font-size: 16px; font-weight: bold; padding-bottom: 10px; text-shadow: 0 1px 1px #CCC; } form#payment fieldset fieldset legend { color: #111111; font-size: 13px; font-weight: normal; padding-bottom: 0; } </style> <body> <?php echo validation_errors(); ?> <?php echo form_open('form'); ?> <form id=payment> <fieldset> <legend>Enter your details</legend> <ul> <li> <label for=name>Name (required)</label></br> <input id=name name=name type=text placeholder="First and last name" required autofocus> </li> <li> <label for=email>Email (required)</label></br> <input id=email name=email type=email placeholder="[email protected]" required> </li> <li> <label for=phone>Phone</label></br> <input id=phone name=phone type=tel placeholder="916-396-9617"> </li> </ul> </fieldset> <fieldset> <legend>Are there a specific properties of interest?</legend> <ul> <li> <label for=address>Address</label></br> <textarea id=address name=address rows=5></textarea> </li> <li> <label for=postcode>Zip code</label></br> <input id=postcode name=postcode type=text> </li> <li> <label for=country>County</label></br> <input id=country name=country type=text> </li> </ul> </fieldset> <fieldset> <legend>How can we help you?</legend> <ul> <li> <label for=address></label> <textarea id=address name=address rows=5></textarea> </li> <li> </br><label for=namecard>How did you hear about us?</label></br> <input id=namecard name=namecard type=text placeholder="Google, Friend, etc..?"> </li> </ul> </fieldset> <fieldset> <button type=submit>SUBMIT</button> </fieldset> </form> </body>
[eluser]Otemu[/eluser]
Hi, I just copied your code and it works fine for me, am using Codeigniter Version 2.1.3 Thanks |
Welcome Guest, Not a member yet? Register Sign In |