0

User gives me a $_POST, I want to check whether keys (not the values) are there.
$_POST keys need to be newemail, firstPassword and secondPassword.

What I have tried:
if (in_array(array_keys($_POST), array("newemail", "firstPassword", "secondPassword"))) echo "Everything in order"..

How to make it actually work?

2
Contributors
2
Replies
11
Views
1 Year
Discussion Span
Last Post by Aeonix
1

http://php.net/array_intersect

The result of the intersect of both arrays, should be an array identical to array("newemail", "firstPassword", "secondPassword")

So, if you do an array_diff() on those two next, you should have an empty array.

Hope it makes sense.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.