PDA

View Full Version : Scriptaculous InPlaceEditor



Joe!
27-11-2008, 11:37 PM
I currently have this working, but I need to implement it into a while() loop. So i'd do like
<?PHP while ($ary = mysql_fetch_array($qry))
{
echo "<span id='editme'>$ary['name']</span>";
}
?>
<script>
new Ajax.InPlaceEditor($('editme'), 'test.php', {okButton: false, okLink: true, cancelLink: true, cancelButton: false,okText: "Update", cancelText: "Oops", highlightcolor: "#CD5555", highlightendcolor: "#000000"});
</script>
which would obviously display all of the names in the table from the database and make all of them editable. This is my problem, how can I let the processing page know which id each name is? Like they would all have ID's within the database. Because as far as i can see, it only parses on the $_POST['value'] value to the processing page? Probably a really dumb question, but ya know its late. Any help would be really appreciated :) I think it all makes sense?:s
Joe

Joe!
28-11-2008, 06:38 PM
Solved it :D
If anyone wants to know, you have to specify your parameters, which I did by doing this

new Ajax.InPlaceEditor('item_<?php echo $item['id'];?>', 'test.php',{callback: function(form, value) { return 'name=' + escape(value)+'&id=<?php echo $item['id'];?>'}});

then it just sends $_POST['name'] * $_POST['id'] :D
If a moderator could close this thread now please =]

Want to hide these adverts? Register an account for free!