-1

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);
    }
LabKitty
  • 51
  • 1
  • 9
  • 3
    There is no `$_REVIEW` superglobal array. Use `$_POST`. – AbraCadaver Nov 10 '14 at 18:56
  • 2
    Sorry, you can only use [official methods listed by RFC standards](http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html). "I heard it should work" where exactly did you "hear" this? – sjagr Nov 10 '14 at 18:56
  • Well, before coming here I asked around people.Thank you. I tough so. – LabKitty Nov 10 '14 at 19:00

2 Answers2

0

The method is the http request type. 'Get' is for just getting the data from the page whereas 'post' is submitting data to the page.

Read this. and this

Data submitted to the page is always going to live inside $_POST.

castis
  • 8,154
  • 4
  • 41
  • 63
  • I actually read those before. Maybe because it didn't inserted with the `$_POST` at firsttime, I moved one. Thank you very much. – LabKitty Nov 10 '14 at 19:15
0

There are only two methods GET and POST . You can put the value of $_POST in to $_REVIEW. Something like this $_REVIEW=$_POST.

Vipin Singh
  • 532
  • 1
  • 7
  • 24
  • Sure it did. The problem you're having is that $_REVIEW isn't global like $_POST is. To use it in that fashion you'd have to add `global $_REVIEW;` at the start of the function. – Andrew Nov 10 '14 at 19:26