pheromix
pheromix

Reputation: 19327

How to remove elements from the $_POST array?

I want to insert a record into a MySQL database table from a formulaire. The problem is that there is a field that is not in the table's columns in the $_POST variable but it's displayed as a textfield in the formulaire. I insert the fields values by this way :

$newRecord->insert($_POST); // we created a generic function insert($array) to insert records

So how to remove an element of the $_POST ?

Upvotes: 4

Views: 7940

Answers (2)

Andrew Cooper
Andrew Cooper

Reputation: 32576

If $_POST contains user-entered data then I really hope that insert function is sanitising the data. If not you're just asking for a SQL injection attack.

Upvotes: 2

Jakub
Jakub

Reputation: 20475

simply go:

unset($_POST['field']);

Upvotes: 20

Related Questions