Samuel Mathews
Samuel Mathews

Reputation: 171

how to remove values of POST variables

can you please clarify my query.. in one part of coding, i would like to initialize or remove the values of POST variables so that the below condition turns TRUE

(!isset(($_POST['abc'])

I did try ($_POST['abc']='') but didnt work as empty value was assigned and !isset condition failed..

hope am clear.. please guide me thro

thanks,

Samuel Mathews.

Upvotes: 1

Views: 2056

Answers (2)

CrayonViolent
CrayonViolent

Reputation: 32532

you can use unset($_POST['abc'])

unset

Though generally speaking, best practice is to treat $_POST as read-only. You should instead copy $_POST to a diff var for manipulation.

Upvotes: 1

Jeff
Jeff

Reputation: 799

You can either unset($_POST['abc']), or check empty($_POST['abc']) instead of isset().

Upvotes: 2

Related Questions