The session id is automatically created by the php server as long as the session has started. You can start the session with code on the top of the page like:
<?php @session_start(); ?>
Then you can use the id at any time with: <?php echo(session_id()); ?>