ultimachris Posted April 8, 2009 Share Posted April 8, 2009 Hi there all, ok, got a strange issue....when i physically view the images.php page i can see my image bright and wonderful, but when i use <?php include("images.php"); ?> as an include into my other php document it gives off an image error the base code reports <img src=''> and no URL. the images.php script is as follows: <?php $image = $_POST['images']; echo "<img src='$image'>"; ?> clearly this code works as its made from user input in a form when they click submit the $image variable is from the form. So how come i can view it as images.php but not when its included? Hope you wizards can help me! Chris Quote Link to comment Share on other sites More sharing options...
ultimachris Posted April 8, 2009 Author Share Posted April 8, 2009 also tried using header include: header('Content-Type: image/gif'); into the images.php document that just gives off: The image “http://images.php” cannot be displayed, because it contains errors.... :( :( Quote Link to comment Share on other sites More sharing options...
ram4nd Posted April 8, 2009 Share Posted April 8, 2009 give us the code of images.php Quote Link to comment Share on other sites More sharing options...
ultimachris Posted April 8, 2009 Author Share Posted April 8, 2009 images.php: <?php $image = $_POST['images']; echo "<img src='$image'>"; ?> the form is: <form action='images.php' method='post' target="new"> <input type="text" name="images"> <input type="submit" value="include image" name="submit"></form> Quote Link to comment Share on other sites More sharing options...
ram4nd Posted April 8, 2009 Share Posted April 8, 2009 if you put image location in the text field it should work. Btw HTML uses double quotes not single or mix. Quote Link to comment Share on other sites More sharing options...
ultimachris Posted April 8, 2009 Author Share Posted April 8, 2009 Hi Ram4nd, the image location depends on the users input, hence why ive used the variable. if i take the base code from images.php its correct, but when i use the include it just gives <img src=' '> Quote Link to comment Share on other sites More sharing options...
ultimachris Posted April 8, 2009 Author Share Posted April 8, 2009 Is there something quite basic i need to do so a include of a PHP file shows an image? Im confused!! Quote Link to comment Share on other sites More sharing options...
schilly Posted April 8, 2009 Share Posted April 8, 2009 when you include it in another file are you making sure to post the form to that new file? Quote Link to comment Share on other sites More sharing options...
ultimachris Posted April 8, 2009 Author Share Posted April 8, 2009 Hi Schilly how do you mean? ive used the $_Post superglobal in my images.php file and the form method is post.... if i manually type the URl into my web browser, it works....if i use <?php include ?> - it doesnt!!! im completly stumped!!! Quote Link to comment Share on other sites More sharing options...
Yesideez Posted April 8, 2009 Share Posted April 8, 2009 Ignore this post - I thought you were using images.php with GD library to actually draw images. Quote Link to comment Share on other sites More sharing options...
ultimachris Posted April 8, 2009 Author Share Posted April 8, 2009 Na, but thanks for your input, im compltely stumped, and ive been doing PHP for over a year.... how does <?include "images.php" > not work when i manually type the url and it does?????? Crazy - the coding is correct...... Quote Link to comment Share on other sites More sharing options...
ultimachris Posted April 8, 2009 Author Share Posted April 8, 2009 I would be willing to pay for someone to fix this problem as im doing this for a client of mine, if you would like to please contact me or PM me, flesheater666@hotmail.com ta, Chris Quote Link to comment Share on other sites More sharing options...
Yesideez Posted April 8, 2009 Share Posted April 8, 2009 <?php include('images.php'); ?> Quote Link to comment Share on other sites More sharing options...
schilly Posted April 8, 2009 Share Posted April 8, 2009 what file are you including images.php in? what file is your form in? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.