Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] input fields added with ajax - no data in $_POST
#1

[eluser]SPeed_FANat1c[/eluser]
Hi,

I have a page let's call it page A, that loads part of its contents using ajax. Ajax calls php function that generate those contents. In those contents there are such lines:

Code:
echo '<input type="hidden" value="'.$offset.'" name="pagination_offset">';
echo '<input type="hidden" value="filtras_visi" name="filter">';

There is a link that sends us to other page - lets call it page B. So in the function that generates page B I use $_POST['filter'] to get data from page, but I don't get it. Also tried $this->input->post('filter') and it din't work too. I want to generate link using this data so I could go back to page A.

You probably understand the problem - in page A is pagination and filter, and when I go back I want to go to the same pagination page and filter.

I could pass data through url but I don't want url full of data. But if I will not find how to pass it in other ways, then I will have to pass through url I guess.

So have you an idea what I could be doing wrong or maybe this is even imposible because when I generate contents with ajax they never can go to $_POST array?

BTW I tried using regular input fields, not hidden, and also it didn't work.
#2

[eluser]LuckyFella73[/eluser]
Quote:There is a link that sends us to other page

If you don't send your form (with a submit button) you won't
get $_POST values on the next page.

You could replace the "link to page B" with a submit button
and set the "action" attr. in you form-tag to page B.
#3

[eluser]SPeed_FANat1c[/eluser]
Thanks. I guess it is not very good practice to do a form, because it would not be a real form where users enter data. I will send data through url I guess.




Theme © iAndrew 2016 - Forum software by © MyBB