jQuery:
$(document).ready(function(){
var numb = 1;
$("#add_pos").live("click", function(){
numb=numb+1;
$("#pos").append('<tr><td style="border-top:1px solid #ccc; font-weight:bold; padding-top:10px; font-size:1.1em;">Pozycja '+numb+'</td></tr><td><input type="hidden" name="pos'+numb+'_id" value="'+numb+'"><input type="text" name="pos'+numb+'_title" size="45"></td></tr><tr><td><textarea name="pos'+numb+'_description" rows="4" style="width:350px"></textarea></td></tr><tr><td><input type="text" name="pos'+numb+'_image" id="pos'+numb+'_image" autocomplete="off"><a href="filesbrowser.php?directory=files/images/glosowania&target=pos'+numb+'_image&iframe" class="fbplus"></a></td></tr><tr><td style="padding-bottom:10px"><input type="text" name="pos'+numb+'_imagebig" id="pos'+numb+'_imagebig" autocomplete="off"><a href="filesbrowser.php?directory=files/images/glosowania&target=pos'+numb+'_imagebig&iframe" class="fbplus"></a></td></tr>');
return false;
});
});
Skrypt:
function dodawanie($atr,$idd) {
$pos_title=filtr($_POST[$atr.'_title']);
$pos_description=filtr($_POST[$atr.'_description']);
$pos_image=filtr($_POST[$atr.'_image']);
$pos_imagebig=filtr($_POST[$atr.'_imagebig']);
//echo 'Zrobione',$atr,'<br>';
mysql_query("INSERT INTO glosowanie values ('','$idd','$pos_title','$pos_description','$pos_image','$pos_imagebig','0')"); }
if (isset($_POST['pos1_id'])) { dodawanie
('pos1',$id); } if (isset($_POST['pos2_id'])) { dodawanie
('pos2',$id); } if (isset($_POST['pos3_id'])) { dodawanie
('pos3',$id); }