<?php
// share.php

// Get the data from the URL
$shared_title = isset($_GET['title']) ? $_GET['title'] : '';
$shared_text = isset($_GET['text']) ? $_GET['text'] : '';

// Display it (or save it to your database)
?>

<!DOCTYPE html>
<html>
<head>
    <title>Share Received</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
        body { font-family: sans-serif; padding: 20px; text-align: center; }
        input, textarea { width: 100%; padding: 10px; margin-bottom: 10px; }
        button { padding: 10px 20px; background: blue; color: white; border: none; }
    </style>
</head>
<body>

    <h3>You shared this content:</h3>
    
    <form action="save_to_database.php" method="POST">
        <label>Title:</label>
        <input type="text" name="title" value="<?php echo htmlspecialchars($shared_title); ?>">

        <label>Link / Text:</label>
        <textarea name="content" rows="5"><?php echo htmlspecialchars($shared_text); ?></textarea>

        <button type="submit">Save</button>
        <br><br>
        <a href="index.php">Go Home</a>
    </form>

</body>
</html>