[eluser]tjackson1982[/eluser]
Hello,
I have some simple files that I would think would capture the POST from a form but just doesn't seem to get the actual data.
Funny thing is it detects if IS data, but doesn't actually collect it - even using the $_POST['field']; method.
I do get a blank entry in my table.
Controller -
Code:
class Posting extends Controller {
var $headline ='';
function Posting()
{
parent::Controller();
$this->load->model('Headline','Posting',TRUE);
}
function index()
{
$this->load->view('posting_page.htm');
}
function posting_headline()
{
$headline = $_POST['headline'];
if ( $this->input->post('headline') !== FALSE ) {
$this->Posting->posting($headline);
}
}
}
Model
Code:
class Headline extends Model {
var $headline ='';
var $source ='';
var $link ='';
var $image_link='';
var $author='';
var $views='';
var $catagory='';
var $date_time='';
function Headline()
{
// Call the Model constructor
parent::Model();
}
function posting($headline_in) {
$headline = $headline_in;//$this->input->post('headline', TRUE);
$source = $this->input->post('source', TRUE);
$link = $this->input->post('link', TRUE);
$image_link = $this->input->post('img_link', TRUE);
$author = $this->input->post('author', TRUE);
$views = $this->input->post('view', TRUE);
$catagory = $this->input->post('catagory', TRUE);
$date_time=time();
$this->db->insert('headline', $this);
}
}
and View file.
Code:
<form method="post" name="posting_form" action="posting_headline/">
Headline title
<input name="headline" type="text">
Source
<input id="source" type="text">
Source Link
<input id="link" type="text">
Any Image links
<input id="img_link" type="text">
Who wrote it
<input id="author" type="text">
How many views (may not be an input)
<input id="view" type="text">
What Catagory
<input id="catagory" type="text">
<input type="submit" value="Submit">
</form>
It all seems logical