Welcome Guest, Not a member yet? Register   Sign In
submit button not redirecting
#1



I'm trying to make a simple codeigniter signup form, but when I press the submit button nothing happens. Not sure what is going wrong. please help. I've posted both my view file and the contoller which i am re-directing in the form.




Code:
<div id="newsletter_form">
   Sign up to our newsletter

   <?php
   echo form_open('email/send');
   ?>

   <?php

   $name_data= array('name'=>'name',
       'id'=>'name',
       'value'=> set_value('name')


   );

   ?>
   <p> <label for=" name"> Name :</label> <?php echo form_input($name_data); ?> </p>  <!--form_input acts like input tag-->

   <p> <label for=" email"> email address:</label>
       <input type="email" name="email" id="email" value="<?php echo set_value('email') ?>" required/> </p>

   <p> <?php echo form_submit('submit','submit');?></p>

   <?php echo form_close(); ?>
</div>



And the below one is my email.php file

Code:
<?php

class email extends CI_Controller
{
   function _construct()
   {
       parent::__construct();
   }

   function index()
   {
       $this->load->view('newsletter_view');
   }


   function send()
   {
       echo "hello";
       $this->load->library('email');
       $this->email->set_newline("\r\n");

       $this->email->from('[email protected]', 'pallavi');
       $this->email->to('[email protected]');
       $this->email->subject('attachment');
       $this->email->message('hello gpks');

       $path = $this->config->item('server_root');  //server_root is set to document root in config.php
       //echo $path; //to make sure path is set to doc root

       $file = $path . '/CI/attachment/hello.txt';

       $this->email->attach($file);
       if ($this->email->send()) {
           echo "your mail was sent";
       } else {
           show_error($this->email->print_debugger());
       }
Reply


Messages In This Thread
submit button not redirecting - by pallu.hegde93 - 11-09-2015, 04:01 AM
RE: submit button not redirecting - by mwhitney - 11-09-2015, 11:33 AM
RE: submit button not redirecting - by InsiteFX - 11-10-2015, 05:07 AM
RE: submit button not redirecting - by mwhitney - 11-10-2015, 01:35 PM
RE: submit button not redirecting - by Martin7483 - 11-11-2015, 01:46 AM
RE: submit button not redirecting - by pdthinh - 11-12-2015, 01:07 AM
RE: submit button not redirecting - by Martin7483 - 11-12-2015, 05:23 AM



Theme © iAndrew 2016 - Forum software by © MyBB