Skip to main content

🚫 | Textgen.php

Here's a page for generating Lorem Ipsum

  1. User can specify how many paragraphs/sentences or how many words they want to generate.
  2. A "generate" button, a "clear" button and a "copy" button with a text area and "clear" button.
<!DOCTYPE html>
<html>
<head>
    <title>Lorem Ipsum Generator</title>
    <style>
        textarea {
            width: 100%;
            height: 200px;
            margin-top: 10px;
        }
    </style>
</head>
<body>
    <h1>Lorem Ipsum Generator</h1>
    <form method="post" action="generate_lorem.php">
        <label for="paragraphs">Number of Paragraphs:</label>
        <input type="text" id="paragraphs" name="paragraphs"><br>

        <label for="sentences">Number of Sentences:</label>
        <input type="text" id="sentences" name="sentences"><br>

        <label for="words">Number of Words:</label>
        <input type="text" id="words" name="words"><br>

        <input type="submit" value="Generate">
        <input type="button" value="Clear" onclick="clearText()">
        <input type="button" value="Copy" onclick="copyText()">
    </form>

    <textarea id="generatedText" readonly></textarea>

    <script>
        function clearText() {
            document.getElementById('generatedText').value = "";
        }

        function copyText() {
            var text = document.getElementById('generatedText');
            text.select();
            document.execCommand('copy');
            alert('Copied to clipboard!');
        }
    </script>
</body>
</html>