yout - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of yout.php
- <?php
- function create_description($title, $description, $tags)
- {
- $array = array();
- $array[] = $title;
- $array[] = $description;
- $array[] = $tags;
- return $array;
- }
- if (isset($_POST['submit'])) {
- /**
- * @param $title
- * @param $description
- * @param $tags
- * @return array
- */
- $description = $_POST['description'] ?? '';
- $title = $_POST['title'] ?? '';
- $tags = $_POST['tags'] ?? '';
- $results = array();
- if ($description && $title && $tags) {
- $results = create_description($title, $description, $tags);
- }
- }
- ?>
- <html>
- <head>
- <title>Youtube description</title>
- <link rel="stylesheet" href="../src/template/style.css">
- </head>
- <body>
- <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
- <div>
- <input type="text" name="title" id="title" placeholder="Title" />
- </div>
- <div>
- <textarea name="description" id="description" cols="30" rows="10" placeholder="Description"><?php echo $description; ?></textarea>
- </div>
- <div>
- <input type="text" name="tags" id="tags" placeholder="tags" />
- </div>
- <div>
- <button type="submit" name="submit" id="submit">
- Create description
- </button>
- </div>
- </form>
- <div class="descriptioncontents">
- <?php
- if($results){
- foreach ($results as $result){
- echo "<div>". $result['title'] ."</div>";
- echo "<div>". $result['description'] ."</div>";
- echo "<div>". $result['tags'] ."</div>";
- }
- }
- ?>
- </div>
- </body>
- </html>
File Description
- yout
- PHP Code
- 28 Jun-2022
- 1.63 Kb
You can Share it:
Latest PHP Pastes