Zmienna w tworzeniu linku |
Zmienna w tworzeniu linku |
1.05.2024, 11:24:06
Post
#1
|
|
Grupa: Zarejestrowani Postów: 15 Pomógł: 0 Dołączył: 15.09.2010 Ostrzeżenie: (0%) |
Chcę zrobić tak, że przychodząca zmienna ma wpływ na konstrukcję linku na stronie.
Najprościej tłumacząc wysyłam 3 osobom link Osoba nr 1: https://www.stronka.pl/index.php?id=1 Osoba nr 2: https://www.stronka.pl/index.php?id=2 Osoba nr 3: https://www.stronka.pl/index.php?id=3 I osoby odwiedzające stronę przez ten link widzą stronę z buttonem o różnej konstrukcji linku. Próbowałem tak: <a href="https://www.stronka.pl/index.php?id=$id"><img src="https://www.stronka.pl/button.png"></a> Jednak zmienna nie jest wstawiana do linku. W linku jest po prostu $id a nie wartość id Oczywiście wcześniej wywołuję zmienną $id = $_REQUEST['id']; Jak zrobić, żeby było dobrze ? |
|
|
1.05.2024, 13:34:06
Post
#2
|
|
Grupa: Zarejestrowani Postów: 377 Pomógł: 70 Dołączył: 15.07.2014 Ostrzeżenie: (0%) |
Demo: https://3v4l.org/D88TE |
|
|
1.05.2024, 18:44:44
Post
#3
|
|
Grupa: Zarejestrowani Postów: 6 783 Pomógł: 1826 Dołączył: 11.03.2014 Ostrzeżenie: (0%) |
-------------------- |
|
|
3.05.2024, 09:29:28
Post
#4
|
|
Grupa: Zarejestrowani Postów: 569 Pomógł: 6 Dołączył: 21.07.2008 Ostrzeżenie: (0%) |
Najprościej tłumacząc wysyłam 3 osobom link Osoba nr 1: https://www.stronka.pl/index.php?id=1 Osoba nr 2: https://www.stronka.pl/index.php?id=2 Osoba nr 3: https://www.stronka.pl/index.php?id=3 Linki wysyłasz względnie poprawnie, więc może zostaw je bez zmian: https://www.stronka.pl/index.php?id=1 itd. natomiast po stronie PHP $id = $_GET['id']; i np. ifem, switchem, itp. $html = '<button value="Button 1">'; if ($id == 2) $html = '<button value="Button 2">'; else if ($id == 3) $html = '<button value="Button 3">'; echo $html; I osoby odwiedzające stronę przez wysłany link widzą stronę z różnym buttonem. -------------------- I welcome you on the Internet >>> Design by Malina
|
|
|
Wersja Lo-Fi | Aktualny czas: 27.09.2024 - 04:51 |