Home > database >  Show the url obtained from a form to image in the result php
Show the url obtained from a form to image in the result php

Time:10-24

sorry for the inconvenience, I have no knowledge of php or html, but I have investigated and can not find anywhere

I have this code of a simple form in the index.html

<form enctype="multipart/form-data" action="/movie/envio.php" method="POST">
  <label for="urlimage">Imagen obtenida:</label>
  <input type="text" id="urlimage" name="urlimage" value="https://image.tmdb.org/t/p/w500{{movie.poster_path}}"><br><br>
 <label for="sinopsis">Sinopsis:</label>
  <input type="text" id="sinopsis" name="sinopsis" value="{{movie.overview}}"><br><br>

 <p><input type="submit" /></p>
</form>

In the shipment.php

Imagen Obtenida: <?php echo htmlspecialchars($_POST['urlimage']); ?><br>
Sinopsis: <?php echo htmlspecialchars($_POST['sinopsis']); ?>
  1. If you go to [https://uniq.edu.mx/movie1 and select a movie, it will take you to the photo and synopsis, I extract that information with the form
  2. The extracted information is sent to envio.php correctly.

How do I do so that instead of showing me the complete url of the image, it shows it as an image inserted in the destination page?

CodePudding user response:

You need to output HTML image tag for that:

<img src="<?= $_POST['urlimage']; ?>"/>
  • Related