我已经发布了表单和表单动作.我试图在一个框中输入一个图像的URL,然后在页面上看到图像


I'm having issued with forms and form-actions. I'm trying to enter an image URL into a box, then see the image on page

我已经尝试了一些事情,但这只是我所理解的边缘,所以我正在抓住我在网上找到的建议的稻草。我觉得我好像错过了什么重要的步骤,但我就是不知道是什么。下面是我的代码:

<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<?php
  if($_POST['formSubmit'] == "Submit") 
  {
    $varImage = $_POST['formStuff'];
  }
?>
<form action="welcome.php" method="get">
  Image URL: <input type="text" name="stuff"><br>
  <input type="submit">
</form>
Image Shown:<br><br> <?php echo $_GET["stuff"]; ?>
</body>
</html>

这里是welcome.php:

<html>
<body>
Image Shown: <br><br><?php echo $_GET["stuff"]; ?>
</body>
</html>

一旦弄清楚了这一点,我打算弄清楚如何使图像成为背景,而不仅仅是图像。耸耸肩。

在welcome.php中试试

    <html>
    <body>
      <?php if(isset($_GET['stuff'])) { ?>
      Image Shown: <br><br><img src="<?php echo $_GET['stuff']; ?>"/>
      <?php } ?>
    </body>
    </html>

你需要使用你的url in标签:像这样:

<img src="<?php echo $_GET['stuff']; ?>"/>