i have a problem with passing POST data. when i check the post data with firebug the data is there. but when i check it in my controller there is nothing.
this is my form:
<form action="<?php echo base_url(); ?>cms/activiteit/saveAct" method="post">
<div class="row">
<div class="col-md-3">Titel:</div>
<input class="col-md-9" type="text" name="title" id="title"/>
</div>
<div class="row">
<div class="col-md-3">Datum:</div>
<input class="col-md-9" type="date" name="date" id="date"/>
</div>
<div class="row">
<div class="col-md-3">Korte beschrijving:</div>
<input class="col-md-9" type="text" name="short" id="short"/>
</div>
<div class="row">
<div class="col-md-3">Lange beschrijving:</div>
<textarea class="col-md-9" name="long" id="long"></textarea>
</div>
<div class="row">
<div class="col-md-12 spatie"></div>
</div>
<div class="row">
<input type="submit" class="col-md-9 col-md-offset-3 btn btn-info" value="Opslaan"/>
</div>
</form>
in my controller i have this:
public function saveAct()
{
$this->output->enable_profiler();
echo 'title: ' . $this->input->post('title');
}
in this picture is the output of the saveAct controller part i read somewhere that this could be my htacces file.
RewriteEngine on
RewriteRule ^(application) - [F,L]
RewriteCond 1ドル !^(index\.php|assets/|assets/bootstrap/|assets/CSS/|assets/font/|assets/font-awesome/|assets/img/|assets/javascript/|assets/JQuery/|cms/|cms/bootstrap/|cms/CSS/|cms/font-awesome/|cms/img/|cms/javascript/|cms/JQuery/|public/)
RewriteRule ^(.*)$ index.php?/1ドル [L]
thanks for the help.
1 Answer 1
looks like incorrect form action
Try to change :-
<form action="<?php echo base_url(); ?>cms/activiteit/saveAct" method="post">
to
<?php echo form_open('activiteit/saveAct');?>
will auto get your site base url and post to controller(activiteit) method(saveAct)
For more :- https://ellislab.com/codeigniter/user-guide/helpers/form_helper.html
leave empty Base url in config or set it to your CI directory http://localhost/yourdir/
5 Comments
controller name AND installation directory is not provided this answer assumes that cms is the installation directory, activiteit - controller AND saveAct - method which CAN be the case . BUT i can see title: echod in the OP pic, any explanation about that ?Explore related questions
See similar questions with these tags.
var_dump($_POST);?