idea:
zapisz: zapisuje dane i zostaje na stronie
poprzednia strona - zapisuje formularz i przechodzi do poprzedniej strony
następna strona - zapisuje formularz i przechodzi do poprzedniej strony...
korzystam z kodu
Formularz:
<form action="#" method="post" class="form" name="form1" id="f1">
Przyciski
<input type="submit" onclick="document.getElementById('f1').action='#';" style="float:right" value="zapisz" /> <input type="submit" onclick="document.getElementById('f1').action='?s=back';" style="float:left" value="poprzednia" /> <input type="submit" onclick="document.getElementById('f1').action='?s=next';" style="float:right" value="nastepna" />
po wysłaniu formualrza sprawdzam wartość $_GET[s] i przekierowuje na odpowiednią stronę
Ogólnie działa... poza jednym przypadkiem
też mam ten kod i 2 formularze na stronie
id="f1"
i id="inny"
<form action="#" method="post" class="form" name="form1" id="f1"> tresc <input type="submit" onclick="document.getElementById('f1').action='#';" style="float:right" value="zapisz" /> </form> <form action="#" method="post" class="form" name="form1" id="inny"> tresc </form> <input type="submit" onclick="document.getElementById('f1').action='?s=back';document.getElementById('f1').submit()" style="float:left" value="poprzednia" /> <input type="submit" onclick="document.getElementById('f1').action='?s=next';document.getElementById('f1').submit()" style="float:right" value="nastepna" />
Już rozwiązałam musiałam dopisać:
document.getElementById('f1').submit()
Działa :-D