Buffmin
01-16-2012, 08:48 PM
Hello. I am new to php, so I don't mean to sound ignorant (although, I can find my way around). I have a vertical nav bar in my html page. Rather than than click on a link and go to "that" page, I would like to just pull the "value" from the selected "list item" and use it as a variable in my php.
My goal is to "acquire" that value so I can use it in my php on this page. (I want to be able to use it in an sql query on this page).
I made an attempt using javascript, and I think the stratedgy might be similar using php.
Could someone please steer me in a direction? I would greatly appreciate it, Buffmin.
I have included my code, but you can see it at http://test.cnjwebsolutions.com/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<ul>
<li><a>Main Menu</a>
<ul class="leftbutton" >
<li><a href="Item1" onclick="return changeList(this);">Item 1</a></li>
<li><a href="Item2" onclick="return changeList(this);">Item 2</a></li>
<li><a href="Item3" onclick="return changeList(this);">Item 3</a></li>
<li><a href="Item4" onclick="return changeList(this);">Item 4</a></li>
<li><a href="Item5" onclick="return changeList(this);">Item 5</a></li>
</ul>
</li>
</ul>
<script type="text/javascript">
function changeList(a)
{
document.write("Value=" + a);
// window.location=location;
return false;
}
</script>
</body>
</html>
My goal is to "acquire" that value so I can use it in my php on this page. (I want to be able to use it in an sql query on this page).
I made an attempt using javascript, and I think the stratedgy might be similar using php.
Could someone please steer me in a direction? I would greatly appreciate it, Buffmin.
I have included my code, but you can see it at http://test.cnjwebsolutions.com/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<ul>
<li><a>Main Menu</a>
<ul class="leftbutton" >
<li><a href="Item1" onclick="return changeList(this);">Item 1</a></li>
<li><a href="Item2" onclick="return changeList(this);">Item 2</a></li>
<li><a href="Item3" onclick="return changeList(this);">Item 3</a></li>
<li><a href="Item4" onclick="return changeList(this);">Item 4</a></li>
<li><a href="Item5" onclick="return changeList(this);">Item 5</a></li>
</ul>
</li>
</ul>
<script type="text/javascript">
function changeList(a)
{
document.write("Value=" + a);
// window.location=location;
return false;
}
</script>
</body>
</html>