# Check for unique id during multiple posts

**URL:** <https://forum.kirupa.com/t/check-for-unique-id-during-multiple-posts/283474>\
**Category:** programming\
**Created:** [March 6, 2009, 4:49pm UTC](https://forum.kirupa.com/t/check-for-unique-id-during-multiple-posts/283474 "2009-03-06T16:49:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dottim](https://avatars.discourse-cdn.com/v4/letter/d/9fc29f/32.png) [@dottim](https://forum.kirupa.com/u/dottim)\
**Post date:** [March 6, 2009, 4:49pm UTC](https://forum.kirupa.com/t/check-for-unique-id-during-multiple-posts/283474/1 "2009-03-06T16:49:06Z")

</div>

I am looking to attach a random id as a $\_GET[] parameter to a form. The form is an upload script with multiple post occurring per session.

I need to check that id on the server side page to see if this $\_GET[‘id’] has arrived for the first time or not.

Meaning when handler.php?id=iouhv9hc82hco2i3y8 has been executed, if the post with $\_GET[‘id’] = iouhv9hc82hco2i3y8 is new for the first time run this script and all other requests with the same id run another script.

I have tried - sessions and cookies and unless I am placing this is the wrong order all I get is the session or cookie writing itself and running the first script.

```php

session_start();
$_SESSION['unique'] = $_GET['id'];

if (isset($_GET['id']) == $_SESSION['unique']) {
    print 'first';
}
else {
    print 'second';
}

```
