Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>ok there are many many solutions to this problem, changing it to an ajax call to the php page to get the image/images would be one, a very simple solution would be this...</p> <pre><code>&lt;?php $image = (isset($_REQUEST['image'])) ? $_REQUEST['image'] : false; $folder = ($image) ? substr($image, 0, 1) : false; ?&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Get url for address bar&lt;/title&gt; &lt;script src="http://code.jquery.com/jquery-1.10.1.min.js"&gt;&lt;/script&gt; &lt;script&gt; var image = '&lt;?php echo ($image) ? $image : "false"; ?&gt;'; var folder = '&lt;?php echo ($folder) ? $folder : "false"; ?&gt;'; var extension = '.jpg'; function DISPLAY(folder,img_name, imgExt) { var finalExt = (typeof imgExt != 'undefined') ? imgExt : extension; if(img_name != 'false' &amp;&amp; folder != 'false') { show_image("http://localhost/UPLOADER/images/"+folder+"/"+img_name+finalExt, 276,110, "Img"); } else { console.log("looks like something was undefined, here's the values:"); console.log(folder); console.log(img_name); } } function show_image(src, width, height, alt) { var img = document.createElement("img"); img.src = src; img.width = width; img.height = height; img.alt = alt; document.body.appendChild(img); } //if using jquery $(document).ready(function() { //you could also add logic here to see if values are not 'false' and run function DISPLAY(folder, image); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form action="" method="POST"&gt; &lt;input type="text" name="image" value="" style="margin-top: 4px;" placeholder="Image_name" /&gt; &lt;button&gt;DISPLAY IMAGE&lt;/button&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload