php - creating menus and forms using <a> tag instead of <form> tag? -


i'm trying learn html properly, i'm still new here. question(s):

  1. is practice create menus using <a> tags?
  2. is practice create forms using <a> tags?
  3. if yes, why bad practice creating them using <form> tags?

the reason behind question did webpage using <form> both login forms , menus well. advised use <a> tags. know may work main menu, find creating functioning login forms tag simpler (since can use attributes such action, target, method , on, , can use submit input type. otherwise have write functions substitute these functionalities).

i hope dont find question stupid, or worst, duplicated. thnx lot

menus , forms different things. menus used navigating around website, while forms used sending data client server.

generally, build menu <a> tags. technically can done using combination of <input type="button"> , javascript, instance <input type="button" onclick="window.location.href='newpage.html'" name="other page"> there's situation calls that. it's messy, requires more code, , isn't supported (since users can disable javascript, or use browser doesn't support it).

forms have built using <form> , <input> tags (there's <textarea>), there's virtually no other option.

for reference, here's example menu (edit: need css make standard menu):

<nav>     <ul>         <li><a href="index.html">home</a></li>         <li><a href="about.html">about us</a></li>         <li><a href="contact.html">contact us</a></li>     </ul> </nav> 

and example form:

<form method="post" name="login" action="process.php">     <input type="text" name="user">     <input type="password" name="pass">     <input type="submit" name="submit"> </form> 

perhaps clear 2 concepts you.


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -