tcorbeil Posted April 13, 2007 Share Posted April 13, 2007 I don't even know where this question classifies itself but hopefully someone can point me in the right direction: If i have a list as such: -NHL -MLB -NBA -NFL Is there a way to have an option like an 'onclick' where each item that is clicked gives a variable such as $clickedvalue the value of the item clicked while at the same time, routing to a function in separate php file? 1) So let's say i clicked on MLB 2) the variable $clickedvalue = item clicked (in this case MLB) 3) call a function in a separate php file for processing.. 4) return to main script. so far i know of the href=# but with it, i can't really give my variable a value.. Maybe i'm asking much so i do appreciate any ideas. Thanks. T Quote Link to comment Share on other sites More sharing options...
Guest prozente Posted April 13, 2007 Share Posted April 13, 2007 if you are wanting to pass a value to a PHP script based on what link is clicked you can use the GET method. example: <a href="script.php?myvariable=MLB">MLB</a> <a href="script.php?myvariable=NBA">NBA</a> then in script.php you would access the variable by using $_GET['myvariable'] Quote Link to comment Share on other sites More sharing options...
tcorbeil Posted April 13, 2007 Author Share Posted April 13, 2007 Awesome! Thanks prozente. Quote Link to comment Share on other sites More sharing options...
tcorbeil Posted April 13, 2007 Author Share Posted April 13, 2007 Actually, here's another question: Can i do exactly wht you mentioned but instead of calling an external script, call a function instead?? Thanks. T Quote Link to comment Share on other sites More sharing options...
Guest prozente Posted April 13, 2007 Share Posted April 13, 2007 You need the php script in order to call a function. Pass the variable through the function you want in script.php Quote Link to comment Share on other sites More sharing options...
tcorbeil Posted April 13, 2007 Author Share Posted April 13, 2007 Ok, that's cool. one last thing.. is there a way to hide the href link? I want to call my script but I don't the link to show at the bottom of explorer or any web browser for that matter.. Thanks again. T. Quote Link to comment Share on other sites More sharing options...
clown[NOR] Posted April 13, 2007 Share Posted April 13, 2007 javascript... onMouseOver() i think... google it "javascript remove link in statusbar" or something like that Quote Link to comment Share on other sites More sharing options...
Guest prozente Posted April 13, 2007 Share Posted April 13, 2007 If you don't want the link to be visible then this defeats the point of the link. If this is the case then don't output the link. If you insist on having the link created but just not visible then you can use CSS. <a style="display:none" href="script.php?foo=bar"> Quote Link to comment Share on other sites More sharing options...
taith Posted April 13, 2007 Share Posted April 13, 2007 <a href="wherever.php" onmouseover="javascript:document.status='';">this should suffice i would think...</a> 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.