Reputation: 59
Suppose I have disable a button on the front end and any user can enable it by Chrome tools. How can I prevent it? Can I validate whether the request front end is changed?
I use Codegniter.
Upvotes: 1
Views: 55
Reputation: 5010
You can track by having a state in your controller passed down to the view.
function contact()
{
$disabled= true;
if($this->input->post('submit') && ! $disabled)
{
//do something
}
$this->load->view('contact', ['disabled' => $disabled]);
}
In your view will be
<button name="submit" <?= $disabled? 'disabled="disabled"': '' ?>>Submit</button>
Upvotes: 1