Mam taki formularz, dzięki któremu pobieram w formie tabeli dane z bazy:
<?php require "/volume1/web/Joomla_1.5/connection/connection.php"; include "/volume1/web/Joomla_1.5/joomla-config-porzadkowe.php"; connection(); $wynik = mysql_query("SELECT * FROM tbl_straznicy_porz order by straznik_nazwisko") or die('Błąd zapytania select'); ?> <form id="formularz_straznik_add" name="formularz_straznik_add" action="straznik_add_update.php" method="post"> <?php $bgcolor="#F3F3F3"; $bgr_color2="#F3F3F3"; $j=0; $lp=0; echo "<td width=15% align=\"center\"><input type=\"tekst\" style=\"width: 130px;\" name=\"new_straznik_nazwisko\" value=\"\"></input></td>"; echo "<td width=15% align=\"center\"><input type=\"tekst\" style=\"width: 130px;\" name=\"new_straznik_imie\" value=\"\"></input></td>"; echo "<td width=10% align=\"center\"><input type=\"tekst\" style=\"width: 90px;\" name=\"new_straznik_stopien\" value=\"\"></input></td>"; echo "<td width=10% align=\"center\"><input type=\"tekst\" style=\"width: 90px;\" name=\"new_straznik_identyfikator\" value=\"\"></input></td>"; echo "<td width=28% align=\"center\"><textarea onblur='this.style.height=18; this.style[\"background\"]=\"#ffffff\";' onfocus='this.style.height=74; this.style[\"background\"]=\"#eeffee\";' type=\"tekst\" style=\"width: 300px; height: 21px;\" name=\"new_straznik_uwagi\" value=\"\"></textarea></td>"; $i=0; $lp=0; $lp++; $i++; if ($bgcolor==$bgr_color2) { $bgcolor="#FFFFFF"; } else { $bgcolor=$bgr_color2; } echo "<td width=8% align=\"center\"><a style=\"text-decoration: none;;\" href=\"del.php?id=".$r['id']."\" onclick=\"setTimeout('document.location.href=document.location.href;',1000);\"><img src=\"../../../modules/mod_porzadkowe/images/x.png\" border=0> usuń</a></td>"; echo "<td width=15% align=\"center\"><input type=\"tekst\" style=\"font-size: 0.75em; width: 130px;\" name=\"".mysql_field_name($wynik,1)."['".$lp."']\" id=\"".mysql_field_name($wynik,1)."['".$lp."']\" value=\"".$r['straznik_nazwisko']."\"></input></td>"; echo "<td width=15% align=\"center\"><input type=\"tekst\" style=\"font-size: 0.75em; width: 130px;\" name=\"".mysql_field_name($wynik,2)."['".$lp."']\" id=\"".mysql_field_name($wynik,2)."['".$lp."']\" value=\"".$r['straznik_imie']."\"></input></td>"; echo "<td width=10% align=\"center\"><input type=\"tekst\" style=\"width: 90px; font-size: 0.75em;\" name=\"".mysql_field_name($wynik,3)."['".$lp."']\" id=\"".mysql_field_name($wynik,3)."['".$lp."']\" value=\"".$r['straznik_stopien']."\"></input></td>"; echo "<td width=10% align=\"center\"><input type=\"tekst\" style=\"width: 90px; font-size: 0.75em;\" name=\"".mysql_field_name($wynik,4)."['".$lp."']\" id=\"".mysql_field_name($wynik,4)."['".$lp."']\" value=\"".$r['straznik_identyfikator']."\"></input></td>"; echo "<td width=28% align=\"center\"><textarea onblur='this.style.height=18; this.style[\"background\"]=\"#ffffff\";' onfocus='this.style.height=74; this.style[\"background\"]=\"#eeffee\";' style=\"width: 300px; font-size: 0.9em;\" name=\"".mysql_field_name($wynik,5)."['".$lp."']\" id=\"".mysql_field_name($wynik,5)."['".$lp."']\" rows=1>".$r['uwagi']."</textarea></td>"; } } echo "<br><table width=99%><td align=right><input type=button onclick='formularz_straznik_add.submit();' value='Zapisz'></td></table><br>"; ?> </form>
No i niestety utknąłem na etapie tworzenia skryptu, który pobierze dane po wysłaniu formularza z tablicy $_POST i zaktualizuje/wstawi właściwe dane do tabeli. Kombinuję już któryś dzień z pętlami foreach ale nie mogę ogarnąć tematu.
Może mnie ktoś bardziej zaznajomiony z tym tematem naprowadzi na właściwe tory.