Reputation: 2913
I have a small PHP application (MVC) with a form. The action looks something like this:
<form action="<?php sprintf("/v/.../update?job=%s", $job->id);?>" method="post">
Here $job
is a PHP object I pass the view from the controller. I hold onto the id
field (an integer) so that I can update the row in the database corresponding to the object.
I'm not seeing this value in $_POST
(it is in $GET
, though) when I step into my update
function for a post request. How should I retrieve this value? Is this expected?
Upvotes: 1
Views: 63
Reputation: 7023
you pass your job param as url string, and in this case it can be seen in $_GET
or $_REQUEST
arraies not $_POST
whatever your form action get or post, because this param isn't form input.
Upvotes: 1
Reputation: 1134
Try to get by $_GET['job'] or remove 'job' from action url and send in hidden text field to get as $_POST['job'].
Also I think your action url is not creating. use echo
<form action="<?php echo sprintf("/v/.../update?job=%s", $job->id);?>" method="post">
Upvotes: 1