Lấy giá trị id trong php

This post is with regards to handling forms that have more than one submit button.

Suppose we have an HTML form with a submit button specified like this:

Normally the 'value' attribute of the HTML 'input' tag [in this case "Delete"] that creates the submit button can be accessed in PHP after post like this:

$_POST['action_button'];
?>

We of course use the 'name' of the button as an index into the $_POST array.

This works fine, except when we want to pass more information with the click of this particular button.

________số 8

Both buttons [Modify and Delete] will be named "action_button" since that's what we want to index the $_POST array with.  In other words, the 'name' of the buttons along cannot carry any uniquely identifying information if we want to process them systematically after submit. Since these buttons will exist for every user in the list, we need some further way to distinguish them, so that we know for which user one of the buttons has been pressed.

This post is with regards to handling forms that have more than one submit button.0

Suppose we have an HTML form with a submit button specified like this:0

Suppose we have an HTML form with a submit button specified like this:1

Suppose we have an HTML form with a submit button specified like this:2

Suppose we have an HTML form with a submit button specified like this:3

Suppose we have an HTML form with a submit button specified like this:4

Suppose we have an HTML form with a submit button specified like this:5

Suppose we have an HTML form with a submit button specified like this:6

Suppose we have an HTML form with a submit button specified like this:7

Cần lưu ý rằng nếu điều này được chạy trên trang chủ Blog, thay vào đó, nó sẽ trả về ID bài đăng được liệt kê đầu tiên thay vì ID trang chủ blog

Trên cùng ↑

Phản hồi

  • Nếu bạn đang tìm kiếm kiểm tra có điều kiện [tôi. e. nếu là trang này, hãy làm điều này], is_single[] kiểm tra xem đó có phải là phiên bản một bài đăng của ID không. Ngoài ra còn có các trang khác cho trang chủ, trang, v.v. Kiểm tra các điều kiện khác cho người khác. https. // codex. báo chí. org/Conditional_Tags — Bởi michaeldhayes — 2 năm trước

Đăng nhập để thêm phản hồi
  • Chuyển đến nội dung ghi chú 2

    Bạn phải đăng nhập để bình chọn về mức độ hữu ích của ghi chú nàyKết quả bình chọn cho ghi chú này. 8Bạn phải đăng nhập để bình chọn về mức độ hữu ích của ghi chú này

    Đóng góp bởi Codex — 8 năm trước

    Mã định danh neo bài đăng
    This post is with regards to handling forms that have more than one submit button.9 có thể được sử dụng để cung cấp một neo duy nhất trong tập lệnh. Ví dụ: trình đơn thả xuống được tạo động với các hành động cho mỗi bài đăng trong kho lưu trữ có thể có

  • Chủ Đề