10. Lấy dữ liệu input từ chuỗi truy vấn (Retriveing input data from query string)
https://viblo.asia/p/tap-16-request-laravel-aWj534Y8K6m
Trong khi method input
dùng để lấy dữ liệu từ input trong request hiện tại (bao gồm cả query string) thì method query
chỉ lấy giá trị từ query string.
Các bạn thay đổi blade view form
như sau:
Các bạn thấy mình đã truyền query string id=1
cho action
. Để lấy query id
, tại method post
của FormController
ta thực hiện cú pháp sau:
Và đây là kết quả:
Previous9. Lấy dữ liệu của một input (Retriveing an input data)Next11. Lấy dữ liệu input thông qua thuộc tính động (Retrieving input via dynamic properties) (ok)
Last updated