zang8027 Posted July 18, 2009 Share Posted July 18, 2009 I got a php file called nav.php with the following code: <?php function navigation($home, $resume, $port, $contact) { echo ' <ul> <li><a href="index/"><img src="images/$home.png" alt="Home Page" /></a></li> <li><a href="resume/"><img src="images/$resume.png" alt="Resume" /></a></li> <li><a href="portfolio/"><img src="images/$port.png" alt="Portfolio Pieces" /></a></li> <li><a href="contact/"><img src="images/$contact.png" alt="Contact" /></a></li> </ul> '; } ?> Then, in my main file, i am using require_once 'nav.php';. Then, i am calling the function navigation("homeBtn", "resumeBtn", "portBtn", "contactBtn); I am getting $contact.png etc.. instead of contactBtn so it acts like its not accepting my params. Any idea? Quote Link to comment Share on other sites More sharing options...
Stephen Posted July 18, 2009 Share Posted July 18, 2009 You need to use double quotes instead of single quotes for it to show the value of the variable. Or you could just do, ' . $home . ' etc. So, <?php function navigation($home, $resume, $port, $contact) { echo ' <ul> <li><a href="index/"><img src="images/' . $home . '.png" alt="Home Page" /></a></li> <li><a href="resume/"><img src="images/' . $resume . '.png" alt="Resume" /></a></li> <li><a href="portfolio/"><img src="images/' . $port . '.png" alt="Portfolio Pieces" /></a></li> <li><a href="contact/"><img src="images/' . $contact . '.png" alt="Contact" /></a></li> </ul> '; } ?> is one way. Quote Link to comment Share on other sites More sharing options...
zang8027 Posted July 18, 2009 Author Share Posted July 18, 2009 thank you, that worked 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.