You cannot in the same page's loading set and check if cookies is set you must perform reload page:
- PHP run at Server;
- cookies at client.
- cookies sent to server only during loading of a page.
- Just created cookies have not been sent to server yet and will be sent only at next load of the page.