Jbert2 Posted June 28, 2008 Share Posted June 28, 2008 I am working on a Photography project. I have an HTML page with an image and several links. Each link is associated with a ( .php ) page. The script on the php page will display the the image in another mode like " Black and White" Right now the only way to get back to the main page is use the Browser Back button. I have search everywhere to find How to insert a link back to, re display the main HTML page from a PHP page. I could use a php menu system for each page but did not want to do that here. Here is partial html code <UL> <LI><a href="http://localhost/kong.php">Grayscale</A> <LI><a href="http://localhost/img2neg.php">Negative</A> When kong.php is run the page only displays kong in grayscale and that is it. Any help is appreciated. JIM Quote Link to comment https://forums.phpfreaks.com/topic/112276-php-to-html-page/ Share on other sites More sharing options...
awpti Posted June 28, 2008 Share Posted June 28, 2008 Well, you have to put a link somewhere. This has nothing to do with PHP. Quote Link to comment https://forums.phpfreaks.com/topic/112276-php-to-html-page/#findComment-576447 Share on other sites More sharing options...
Jbert2 Posted June 28, 2008 Author Share Posted June 28, 2008 Thanks, but I have tried to put a link on the PHP page and it will not display. A regular HTML a href link will not work since the page is PHP. there is no <body> tags THOUGHT now please Quote Link to comment https://forums.phpfreaks.com/topic/112276-php-to-html-page/#findComment-576528 Share on other sites More sharing options...
MasterACE14 Posted June 28, 2008 Share Posted June 28, 2008 HTML works perfectly fine within a PHP page. use something like this: <?php // all your image manipulation code goes here... // now put the link in echo '<UL> <LI><a href="http://localhost/somepage.html">Some Page</A>'; ?> Regards ACE Quote Link to comment https://forums.phpfreaks.com/topic/112276-php-to-html-page/#findComment-576541 Share on other sites More sharing options...
Jbert2 Posted June 28, 2008 Author Share Posted June 28, 2008 Thanks ACE, Here is the ending of the code, got the same parse error // get the Value from the RGB value $g = round(($rr + $gg + $bb) / 3); // grayscale values have r=g=b=g $val = imagecolorallocate($im, $g, $g, $g); // set the gray value imagesetpixel ($im, $i, $j, $val); } } header('Content-type: image/jpeg'); imagejpeg($im); echo <a href="http://localhost/img2neg.html">Some Page</A>; ?> Quote Link to comment https://forums.phpfreaks.com/topic/112276-php-to-html-page/#findComment-576575 Share on other sites More sharing options...
jeremyapp Posted June 29, 2008 Share Posted June 29, 2008 echo <a href="http://localhost/img2neg.html">Some Page</A>; should be echo '<a href="http://localhost/img2neg.html">Some Page</A>'; Also this is nitpicking, but if you want your HTML to validate you should use all lowercase tags As in: </a> instead of </A> Quote Link to comment https://forums.phpfreaks.com/topic/112276-php-to-html-page/#findComment-577086 Share on other sites More sharing options...
MasterACE14 Posted June 29, 2008 Share Posted June 29, 2008 output your header first thing in the page. <?php header('Content-type: image/jpeg'); and whats the parse error? Quote Link to comment https://forums.phpfreaks.com/topic/112276-php-to-html-page/#findComment-577117 Share on other sites More sharing options...
wildteen88 Posted June 29, 2008 Share Posted June 29, 2008 You cannot output HTML if you're using the image/jpeg content type header. Quote Link to comment https://forums.phpfreaks.com/topic/112276-php-to-html-page/#findComment-577153 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.