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

Hi there,

Im newbie with CI also php. Im learning everyday.

I did the tutorial from CodeIgniter, specifically about StaticPages.

So I have Class Pages, and function view.

I wanna put a Contact Form, this one (https://github.com/abkr/codeigniter-contact-form) so i create a new controller named Contact.php and the view from the source.

When i go to: url.com/contact of course i got an error: Call to undefined function validation_errors()

I guess when "contact" is called, first call to "Pages" controller?

My question is how can I add this Contact Form into my "contact" whithout disturbing my ClassPages from tutorial.

Sorry for my bad english.
Reply
#2

What leads you to believe that this error message has anything to do with your "Pages" controller?

Paste your Contact controller code, and make sure you have your form_validation library and helper loaded.
Reply
#3

@孤单的小猴子

"My question is how can I add this Contact Form into my "contact" whithout disturbing my ClassPages from tutorial."

Rework the current form to post via AJAX or find another contact form that has AJAX implementation (search with "php ajax contact form"). The AJAX controller would be separate. Place the html code and the corresponding javascript of the contact form somewhere within the corresponding static view. Thus, the controller of the page would not be touched.

Here is an implementation of mine that maybe would be little bit complicated for you, but it demonstrates what you want. http://iridadesign.com/starter-public-ed...-page-test Make something similar.
Reply
#4

(10-08-2015, 02:47 AM)孤单的小猴子 Wrote: Hi there,

Im newbie with CI also php. Im learning everyday.

I did the tutorial from CodeIgniter, specifically about StaticPages.

So I have Class Pages, and function view.

I wanna put a Contact Form, this one (https://github.com/abkr/codeigniter-contact-form) so i create a new controller named Contact.php and the view from the source.

When i go to: url.com/contact of course i got an error: Call to undefined function validation_errors()

I guess when "contact" is called, first call to "Pages" controller?

My question is how can I add this Contact Form into my "contact" whithout disturbing my ClassPages from tutorial.

Sorry for my bad english.


Hi~
You can paste the code to see where there are problems.
the founder of CodeIgniter Chinese community - http://codeigniter.org.cn
Reply
#5

(10-08-2015, 02:47 AM)孤单的小猴子 Wrote: I wanna put a Contact Form, this one (https://github.com/abkr/codeigniter-contact-form) so i create a new controller named Contact.php and the view from the source.

When i go to: url.com/contact of course i got an error: Call to undefined function validation_errors()

This error message indicates that you need to add the following line to your Contact controller's constructor (or the method which loads the view):

PHP Code:
$this->load->helper('form'); 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB