Aim: To allow a User to create a URL through an Input Field and Dynamically Add something onto the page that specific URL parameter leads to
example: User Enters word "box" into the field, the input "box" is stored in database and a custom URL having the "box" parameter is generated, I wish to put some content onto that URL and the URL should only display the input.
Result: "localhost/3/UrlGeneration.php?url=Box"
Expected: "localhost/3/Box"
(PS: Maybe I am doing this wrong and should create individual files for each input but that would result in A LOT OF FILLLLLEEEES which held me back from doing that)
<form action="UrlGeneration.php" method="GET">
<input type="text" name="url" size="25" placeholder="Enter Custom URL">
<button type="submit">Launch</button>
</form>
<?php
include('Includes/php/Connect.php');
$URL = $conn->real_escape_string($_REQUEST['url']);
$Time = $conn->real_escape_string($_SERVER["REQUEST_TIME"]);
$sql = "INSERT INTO url (room, tstamp) VALUES ('$URL', '$Time')";
mysqli_query($conn, $sql);
$url = "http://localhost/UrlGeneration.php?$URL";
header($url);
// Close connection
mysqli_close($conn);
?>