Welcome Guest, Not a member yet? Register   Sign In
Issue with database record updating: updating record inside a foreach loop?
#15

[eluser]Salvatore Formisano[/eluser]
no no no.. sorry, I realize I am not being very clear Smile

what my js does is basically the same action performed by a javascript input serializer (jquery serialize for instance).

this
Code:
$.post('<?php echo site_url('admin/photos/reorder_photos');?>',form_data,function(res){
        alert("done")
    });

sends the form_data string as if it was a full form with these fields:

Code:
<form action="admin/photos/reorder_photos">

<input type="text" id="354" name="354" value="1" />
<input type="text" id="564" name="564" value="2" />
<input type="text" id="384" name="384" value="3" />
</form>

this kind of context is emulated by the javascript, which you can see in the js I posted.

This is to say that my controller does NOT receive a single string like this:

Code:
<form action="admin/photos/reorder_photos">
<input type="text" id="string" name="string" value="354=1&564=2&999=3" />
</form>

therefore I don't have something like $_POST['string'] which contains "354=1&564=2&999=3"

I have $_POST['354'] which contains "1", $_POST['564'] which contains 2...


I hope I was a bit more clear, not sure though (very tired!)


but an handful of ids and values


Messages In This Thread
Issue with database record updating: updating record inside a foreach loop? - by El Forum - 12-16-2009, 07:09 AM



Theme © iAndrew 2016 - Forum software by © MyBB