I made two separate databases for my posts, one for article and one for review.
My two database tables, are basically the same.
CREATE TABLE IF NOT EXISTS `post` (
`post_id` int(11) NOT NULL,
`post_title` varchar(25) NOT NULL,
`post_text` varchar(500) NOT NULL,
`post_img` varchar(255) NOT NULL,
`post_pic` varchar(255) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
For articles I used controller:
function index_ajax()
{
echo "\$_POST:<br>";
var_dump($_POST);
}
function index_post()
{
echo "\$_POST:<br>";
var_dump($_POST);
$data = $_POST['data'];
$data['post_id'] = $this->params[0];
insert('post', $data);
}
Now I needed make basically same for review posts.
function index_ajax()
{
echo "\$_REVIEW :<br>";
var_dump($_REVIEW);
}
function index_review()
{
echo "\$_REVIEW:<br>";
var_dump($_REVIEW);
$data = $_REVIEW['data'];
$data['review_id'] = $this->params[0];
insert('review', $data);
}
The articles are going nicely into database, but the same method wont work for reviews.
I did change in my form from <form class="form-inline" method="post" role="form">
to <form class="form-inline" method="review" role="form">
I have kind of feeling it wont just work for it
I heard it should work, but it doesn't actually. I am grateful for new tips and ideas.
Thank you!
Update. For someone who reads this in future.
function index_ajax()
{
echo "\$_POST:<br>";
var_dump($_POST);
}
function index_post()
{
echo "\$_POST:<br>";
var_dump($_POST);
$data = $_POST['data'];
$data['review_id'] = $this->params[0];
insert('review', $data);
}