Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [HTML][PHP]Kotwica na stronie
krzesik
post
Post #1





Grupa: Zarejestrowani
Postów: 517
Pomógł: 1
Dołączył: 25.08.2012

Ostrzeżenie: (0%)
-----


Witam, oto mój fragment kodu:
  1. .........
  2. echo "<td>".$r[type]."</td>";
  3. echo "<td>".$r[name]."</td>";
  4. echo '<td>
  5. <action=\"tele.php\">
  6.  
  7. <input type=hidden id=id_lol name=id_lol value='.$r[id_lol].'>
  8. <input type="text" style="width:30%;" name="kod" title="Kod" value='.$r[kod].'></input>
  9. <button type=submit value=Zatwierdź><img src=img/ikony/zapisz.png title=Zatwierdzam! style=width:15px;height:15px;border:0px; /></button></td>';
  10. ................
  11.  
  12. if(!empty($kod))
  13. {
  14. $qwe=mysql_query("UPDATE .......") or die('Błąd zapytania');
  15.  
  16. ?><meta http-equiv="refresh" content="0; url=tele.php#<? echo $id_lol; ?>"><?
  17. }


Wszystko działa, zapisuje się do bazy, ale chciałbym aby po zapisaniu strona "ustawiła się" przy zapisywanym rekordzie u góry strony. Link generuje się poprawnie:
http://xxxxxx/tele.php#3

Gdzie robię błąd?

Ten post edytował krzesik 30.06.2016, 10:42:20
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 9)
phpion
post
Post #2





Grupa: Moderatorzy
Postów: 6 072
Pomógł: 861
Dołączył: 10.12.2003
Skąd: Dąbrowa Górnicza




No ale nigdzie nie masz wspomnianej kotwicy.
Go to the top of the page
+Quote Post
Arcioch
post
Post #3





Grupa: Zarejestrowani
Postów: 324
Pomógł: 110
Dołączył: 18.09.2012

Ostrzeżenie: (0%)
-----


A czy na pewno w swoim kodzie masz div o id 3?
Nie widzę abyś gdzieś taki generował
Go to the top of the page
+Quote Post
krzesik
post
Post #4





Grupa: Zarejestrowani
Postów: 517
Pomógł: 1
Dołączył: 25.08.2012

Ostrzeżenie: (0%)
-----


hmmm, myślałem, że to jest kotwica:
<input type=hidden id=id_lol name=id_lol value='.$r[id_lol].'>
Go to the top of the page
+Quote Post
viking
post
Post #5





Grupa: Zarejestrowani
Postów: 6 381
Pomógł: 1116
Dołączył: 30.08.2006

Ostrzeżenie: (0%)
-----


To jest nazwa id_lol. Zrób tak jak dla value.
Go to the top of the page
+Quote Post
krzesik
post
Post #6





Grupa: Zarejestrowani
Postów: 517
Pomógł: 1
Dołączył: 25.08.2012

Ostrzeżenie: (0%)
-----


Zrobiłem tak:
  1. ..........
  2. echo "<td>".$r[type]."</td>";
  3. echo "<td>".$r[name]."</td>";
  4. echo '<td>
  5. <action=\"tele.php\">
  6. <div id="'.$r[id_lol].'"></div>
  7. <input type=text name=id_lol value='.$r[id_lol].'></input>
  8. <input type="text" style="width:30%;" name="kod" title="Kod" value='.$r[kod].' ></input>
  9. <button type=submit value=Zatwierdź><img src=img/ikony/Save.png title=Zapisz! style=width:15px;height:15px;border:0px; /></button></td>';


i poźniej:

?><meta http-equiv="refresh" content="0; url=tele.php#<? echo $id_lol; ?>"><?

coś tam niby "próbuje " się ustawić na danym rekordzie ale ciągnie tabelę o kilkanaście rekordów w górę.....
Go to the top of the page
+Quote Post
trueblue
post
Post #7





Grupa: Zarejestrowani
Postów: 6 807
Pomógł: 1828
Dołączył: 11.03.2014

Ostrzeżenie: (0%)
-----


http://stackoverflow.com/questions/1015828...in-an-html-href
http://stackoverflow.com/a/20565694/5889778
Go to the top of the page
+Quote Post
krzesik
post
Post #8





Grupa: Zarejestrowani
Postów: 517
Pomógł: 1
Dołączył: 25.08.2012

Ostrzeżenie: (0%)
-----


ciekawe jest to że jak wpiszę z palca adres z np #32 to pozycjonuje poprawnie
Go to the top of the page
+Quote Post
viking
post
Post #9





Grupa: Zarejestrowani
Postów: 6 381
Pomógł: 1116
Dołączył: 30.08.2006

Ostrzeżenie: (0%)
-----


Ciekawe to jest co masz w zmiennej $id_lol i gdzie ja iniciujesz. Co to jest td > action w html?
Go to the top of the page
+Quote Post
krzesik
post
Post #10





Grupa: Zarejestrowani
Postów: 517
Pomógł: 1
Dołączył: 25.08.2012

Ostrzeżenie: (0%)
-----


więc tak:
mam tabelę, a w kazdym rekordzie inputa oraz przycisk zapisz. Mając na uwadze, że tabela jest długa i np user zapisujący rekord 123 otrzymałby zapis i powrót na górę strony - tego chciałbym uniknąć..
po zapisie wykonuje się:

?><meta http-equiv="refresh" content="0; url=tele.php#<? echo $id_lol; ?>"><?

wynik adresu jest ok:
?><meta http-equiv="refresh" content="0; url=tele.php#36"><?
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 7.10.2025 - 03:06