Jump to content

[SOLVED] Displaying a picture from a form input


NewbieBryan

Recommended Posts

Hi All,

 

I am extremely new to php (and this forum) and am hoping to get some assistance. If this is not the right place to ask this question, if not; MODs please move the post to the correct section and apologies

 

What I am trying to do:

create a form that asks for an image name and then display that image on the next page. Sounded easy when I thought about it .... but, doesnt appear so. ???

All the images I want to display are in the folder where the code is.

 

Code: Input page

<html>

<body>

 

<form action="display.php" method="post">

Name: <input type="text" name="imagename" />

<input type="submit" />

</form>

 

</body>

</html>

 

Code: display.php page

 

<?php

 

$Image = "$_POST[imagename]";

 

//to check my variable from the form

echo $Image;

 

 

?>

 

 

<html>

<head>

<title>Test image output page</title>

<A href="test.php">Go back to submit again</A>.

</head>

 

 

 

<body>

 

<img src="<$_POST["company"]>" width="200" height="200"

 

</body>

 

Now ....

 

Clearly this doesn't work - I have triend putting the <imgscr> in the php section but that just bombs ....

 

I have spent the last 5 hours on this (searching the net / trial and error / etc) and am going around in circles ....

 

Any help would be appretiated.

 

Thx

 

Bryan

 

 

 

 

 

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.