-3

I am making contact form in codeigniter but i dont know how to clear this error ?so for i tried?Today only I am working with codeigniter.can anyone helpme? I got the error: A PHP Error was encountered Severity: Notice Message: Use of undefined constant ‘contact_form’ - assumed '‘contact_form’' Filename: controllers/contact.php Line Number: 33 IN application controller:

<?php
    class contact extends ci_controller 
    {
        public function __construct()
        {
            parent::__construct();
        }
        public function index()
        {
            $mail_sent = false;
            if ($this->input->post("q"))
            {
                // Loading email library of Codeigniter
                $this->load->library(‘email’);
                // Loading configuration file mail_config.php
                $this->config->load(‘mail_config’,true);
                // Setting email address and name of the person sending the email
                $this->email->from($this->input->post("from"),$this->input->post("name"));
                // Setting email address of the recipient
                $this->email->to($this->config->item(‘to’,’mail_config’));
                // Setting email subject
                $this->email->subject($this->input->post("subject"));
                // Setting email message body
                $this->email->message($this->input->post("message",true));
                // If mail sending successful
                if ($this->email->send())
                {
                    // If $mail_sent = true; it will show a success message.
                    $mail_sent = true;
                }
            }
            $this->load->view(‘contact_form’,array(‘mail_sent’=>$mail_sent));
        }
    }
?>

In view:I have created contact_form.php

<?php 
    if ($mail_sent): 
?>
        <b>Mail Sent</b>
<?php 
    endif; 
?>
<form action="<?php echo base_url() ?>" method="POST">
    <b>Your Name :</b>
    <br />
    <input type="text" name="name"  value=""/>
    <br />
    <b>Your Email Address:</b>
    <br />
    <input type="text" name="from" value=""/>
    <br />
    <b>Subject :</b>
    <br />
    <input type="text" name="subject"  value=""/>
    <br />
    <b>Message :</b>
    <br />
    <textarea name="message" rows="10" cols="15"></textarea>
    <br />
    <input type="submit" name="q" value="Contact" />
</form>
Vidhi
  • 2,026
  • 2
  • 20
  • 31
acer s
  • 1

1 Answers1

0

You're using the wrong character, replace with '.

Karoly Horvath
  • 94,607
  • 11
  • 117
  • 176
  • Thank you for your answer how to store these values in database?more over I want to know how to get the value from form and store in variable, because just i took it from google.i want to know in proper way – acer s Oct 25 '14 at 07:50
  • read a book, tutorial, article. if you get lost, ask a question. but not in the comment section. – Karoly Horvath Oct 25 '14 at 07:55
  • sure i will do that..once again thanks lot. – acer s Oct 25 '14 at 07:58