[eluser]FREEZA[/eluser]
Hello!
I dont know why doesn't my form send the
$_POST['text_submit']... He sends only
$_POST['content']
Code:
Code:
// Form Data
$submit = array(
'name' => 'text_submit',
'id' => 'text_submit',
'value' => 'Send',
'class' => 'button blue-button '
);
$content = array(
'name' => 'content',
'id' => 'text',
'placeholder' => 'Write?',
);
echo form_open('entry/doEntry', 'id="entryForm"');
echo '<div id="pfichtfeld-error" class="error">Required Fields...</div>';
echo form_textarea($content);
echo form_submit($submit);
echo form_close();
Code:
// Js...
$('#text_submit').click(function() {
var data = $('#entryForm').serialize();
$.ajax({
url: "<?php echo site_url('entry/doEntry') ?>",
type: 'POST',
data: data,
success: function(msg) {
// Required Fields
if (msg == "Pflichtfeld"){
$('#pfichtfeld-error').fadeIn('slow');
}
// Its OK
if (msg == "OK"){
$('#pflichtfeld-error').hide();
$.fancybox.close();
[removed].reload();
; }
Controller:
Code:
// Text__Textarea
if(isset($_POST['text_submit'])){
// Pflichtfelder
if (empty($_POST['content'])){
$error = 'Pflichtfeld';
}
// Wenn kein Error
if(empty($error)){
$this->load->model('entry_model');
if($this->entry_model->insert()){
$error= "OK";
}
}
echo $error;
}
else{
echo "no!!!";
}
}
Firebug says me that only $_POST['content'] was send... not $_POST['text_submit'] ... why?