@daisha
In CodeIgniter, you can get the POST data by using the $this->input->post()
method in your controller. This method returns an array of all POST data.
For example, if you have a form with two input fields named "name" and "email", you can get the values of these fields in your controller like this:
1 2 |
$name = $this->input->post('name'); $email = $this->input->post('email'); |
If you want to get all POST data at once, you can use:
1
|
$data = $this->input->post(); |
This will return an array with all POST data, where the keys are the field names and the values are the field values.
You can also use the $this->input->post('field_name', TRUE)
method to retrieve and sanitize the POST data. The second argument (TRUE) specifies that the data should be escaped to prevent against cross-site scripting (XSS) attacks.
1 2 |
$name = $this->input->post('name', TRUE); $email = $this->input->post('email', TRUE); |
I hope this helps! Let me know if you have any questions.
@daisha
To get the post data in a Codeigniter controller, you can use the $this->input->post()
method. Here's an example:
1 2 3 |
public function myMethod() { $myVariable = $this->input->post('myVariable'); } |
Note: Make sure that you have set the form method as post in your HTML form, e.g., <form method="post">
.