Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [Symfony][Symfony2]symfony 2.8 problem z metodą post
szypi1989
post 10.08.2017, 08:39:17
Post #1





Grupa: Zarejestrowani
Postów: 207
Pomógł: 0
Dołączył: 7.09.2010

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


Witam. Otóż mam formularz i wysyłam metodą POST i nie mogę dostać danych. Próbuje tak jak jest w dokumentacji?
  1. $request_data=$request->request->get('marka', 'default value if bar does not exist');
  2. echo "dane: ".$request_data;

I nic mi nie wyświetla . Pomimo tego dobrych danych. Próbowałem na różne sposoby i nic.

Ten post edytował szypi1989 10.08.2017, 08:39:59
Go to the top of the page
+Quote Post
viking
post 10.08.2017, 08:49:41
Post #2





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

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


var_dump($request->request);


--------------------
Go to the top of the page
+Quote Post
szypi1989
post 10.08.2017, 09:57:08
Post #3





Grupa: Zarejestrowani
Postów: 207
Pomógł: 0
Dołączył: 7.09.2010

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


  1. object(Symfony\Component\HttpFoundation\ParameterBag)#9 (1) { ["parameters":protected]=> array(1) { ["form"]=> array(10) { ["model"]=> string(11) "sadfasdfsda" ["mark"]=> string(6) "sadfas" ["price"]=> string(7) "sadfsad" ["enginetype"]=> string(6) "diesel" ["enginea"]=> string(1) "2" ["engineb"]=> string(1) "4" ["yearfrom"]=> string(1) "0" ["yearto"]=> string(1) "0" ["save"]=> string(0) "" ["_token"]=> string(43) "oPTfhUwDQMErkJMBdyrKEDYPjxeKuZj-oZzr53rcfgY" } } }


No próbowałem takie coś . I wyświetla mi tak:
nie wiem jak dojść do tej tablicy?

Ten post edytował szypi1989 10.08.2017, 09:58:54
Go to the top of the page
+Quote Post
viking
post 10.08.2017, 10:01:19
Post #4





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

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


Jest mark nie marka.


--------------------
Go to the top of the page
+Quote Post
szypi1989
post 10.08.2017, 10:01:58
Post #5





Grupa: Zarejestrowani
Postów: 207
Pomógł: 0
Dołączył: 7.09.2010

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


no ja wiem. Bo źle napisałem wyżej . NO ale i tak nie wychodzi
Go to the top of the page
+Quote Post
nospor
post 10.08.2017, 10:08:48
Post #6





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




Cytat
I nic mi nie wyświetla
Napisu:
"dane:"
tez ci nie wyswietla?


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
szypi1989
post 10.08.2017, 10:11:12
Post #7





Grupa: Zarejestrowani
Postów: 207
Pomógł: 0
Dołączył: 7.09.2010

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


nic a nic..
w poprzednim symfony nie było tego problemu. Próbowałem z każdych pól. A w dokumentacji pisze aby tak robić.

Ten post edytował szypi1989 10.08.2017, 10:11:37
Go to the top of the page
+Quote Post
viking
post 10.08.2017, 10:11:23
Post #8





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

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


A form['mark']? Ewentualnie $request->request->get('form')['mark']. Już nie pamiętam jak to było w symfony.
http://api.symfony.com/2.3/Symfony/Compone...rameterBag.html


--------------------
Go to the top of the page
+Quote Post
szypi1989
post 10.08.2017, 10:13:16
Post #9





Grupa: Zarejestrowani
Postów: 207
Pomógł: 0
Dołączył: 7.09.2010

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


o kurde...faktycznie zapomniałem form. Dziękuje Ci bardzo :-)
Go to the top of the page
+Quote Post

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

 



RSS Wersja Lo-Fi Aktualny czas: 25.06.2025 - 16:48