What are some potential pitfalls of relying on HTTP_REFERER for obtaining parent information in PHP scripts?

Relying on HTTP_REFERER for obtaining parent information in PHP scripts can be unreliable as it can be easily manipulated or spoofed by users. A more secure approach would be to pass the parent information through a hidden form field or session variable.

// Using a hidden form field to pass parent information securely

<form action="process.php" method="post">
    <input type="hidden" name="parent_id" value="<?php echo $parent_id; ?>">
    <!-- Other form fields -->
    <button type="submit">Submit</button>
</form>