chiching72 Posted February 21, 2007 Share Posted February 21, 2007 I am trying to make a navigation on my HTML page, where there is a list of links for lessons... example, lesson1, lesson2, etc. I want to click on the link which would lead to a PHP page inside my HTML table, and give the PHP a variable, such as for lesson1, it would be "lesson1.cml", so that it knew it for was for lesson1. How do I accomplish This? I am sorry if I am not too clear, I am desperate for any help tho, thanks!~ Link to comment https://forums.phpfreaks.com/topic/39554-solved-html-links-as-php-variables/ Share on other sites More sharing options...
skali Posted February 22, 2007 Share Posted February 22, 2007 I am not sure if this is what you are asking but to pass variables from links to php you need to send them in the URL of link. This can be accomplished by: <a href="http://lessons.php?selected_lesson=lesson1.cml">Lesson1</a> <a href="http://lessons.php?selected_lesson=lesson2.cml">Lesson2</a> <a href="http://lessons.php?selected_lesson=lesson3.cml">Lesson3</a> Thus after the file name you put a '?' and then add a variable name put an '=' and then the value of the variable. Now on the php page that is lesson.php in this case you can retrieve the value of which lesson was clicked. use $selected_lesson = $_GET['selected_lesson']; And there you have it. $selected_lesson now holds the lesson user clicked on. Link to comment https://forums.phpfreaks.com/topic/39554-solved-html-links-as-php-variables/#findComment-190971 Share on other sites More sharing options...
chiching72 Posted February 22, 2007 Author Share Posted February 22, 2007 thanks a lot! Link to comment https://forums.phpfreaks.com/topic/39554-solved-html-links-as-php-variables/#findComment-191032 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.