What are the advantages and disadvantages of using hidden inputs versus URL attachment for session ID transmission in PHP?

When transmitting session IDs in PHP, using hidden inputs has the advantage of keeping the session ID invisible to the user, enhancing security. However, it can lead to bloated forms and potential accessibility issues. On the other hand, attaching the session ID to URLs is simple and lightweight but can expose the session ID in the browser history and referrer logs, posing a security risk.

// Using hidden inputs for session ID transmission
<form action="process.php" method="post">
    <input type="hidden" name="session_id" value="<?php echo session_id(); ?>">
    <!-- Other form fields here -->
    <button type="submit">Submit</button>
</form>
```

```php
// Attaching session ID to URLs for transmission
<a href="process.php?session_id=<?php echo session_id(); ?>">Submit</a>