<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    // Retrieve the input values
    $urls = $_POST['urls'];
    $words = $_POST['words'];

    // Split the input values into arrays
    $urlArray = explode("\n", $urls);
    $wordArray = explode("\n", $words);

    // Generate hyperlink code
    $hyperlinkCode = '';
    foreach ($urlArray as $index => $url) {
        $word = isset($wordArray[$index]) ? $wordArray[$index] : '';
        $hyperlinkCode .= '<a href="' . $url . '">' . $word . '</a>' . PHP_EOL;
    }

    // Generate BB code
    $bbCode = '';
    foreach ($urlArray as $index => $url) {
        $word = isset($wordArray[$index]) ? $wordArray[$index] : '';
        $bbCode .= '[url=' . $url . ']' . $word . '[/url]' . PHP_EOL;
    }
}
?>


<form method="post">
    <label for="urls">Enter URLs (one per line, up to 5000):</label><br>
    <textarea id="urls" name="urls" rows="5" cols="50"></textarea><br>

    <label for="words">Enter Words (one per line, up to 5000):</label><br>
    <textarea id="words" name="words" rows="5" cols="50"></textarea><br>

    <input type="submit" value="Submit">
</form>


<?php if (isset($hyperlinkCode)) : ?>
    <h3>Hyperlink Code:</h3>
    <pre><?php echo htmlentities($hyperlinkCode); ?></pre><?php endif; ?><?php if (isset($bbCode)) : ?><h3>BB Code:</h3><pre><?php echo htmlentities($bbCode); ?></pre><?php endif; ?>


Super Web Development LLP
Logo
Shopping cart