PHP LI Form Post and return Value -


i stuck on last bit of have list , when 1 clicked form submits. dont understand how value of item clicked.

how can echo or put variable use? or there better way achieve this?

<head> <script type="text/javascript" language="javascript"> function submit(target) {     document.forms['myform'].elements['target'].value = target;     document.myform.submit();     }      </script>       </head>      <body>       <form name="myform" method="post">     <li><a href="#" onclick="submit('a');">a</a></li>     <li><a href="#" onclick="submit('b');">b</a></li>     <li><a href="#" onclick="submit('c');">c</a></li>     <input name="target" type="hidden" value=""/>     </form>     </body> 

ok tried following jquery. seems work in gives alert value need. doesnt seem refresh page - need value chosen can use in query in page. how tdo refresh page , put value variable?

<script type='text/javascript'>//<![cdata[  $(document).ready(function(){         $(".inter li").bind(         "click", function(){             alert($(this).children("a").text());         });     });  

</head> <body>   <div class="inter">   <p>liste des produits</p>   <ul>       <li><a href="#1">p1</a></li>       <li><a href="#2">p2</a></li>       <li><a href="#3">p3</a></li>   </ul> </div>    </body> 

its better use without javascript , use radio buttons this. if must use javascript try jquery.


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -