SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Addict
    Join Date
    May 2011
    Posts
    242
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    HTML form buttons are not working

    Hi,

    I have a website developed with HTML and CSS.
    This website has buttons for making selections and move from one page to the next one. All buttons' code is like this:

    <form action="target_URL" method="post">
    <h2 class="h2button">
    <input type="submit" value="Enter" class="lists_button">
    </h2>
    </form>

    During the last few weeks, some persons have told me that nothing happens when they press the button, it is, the page stays where it is and does not go to the next one.

    Any idea of what could be the problem here?

    Thanks a lot!!!

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,214
    Mentioned
    457 Post(s)
    Tagged
    8 Thread(s)
    That's pretty odd code for something like this. Why not use links?

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,837
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    If you don't want to use <a> then use <button> - you only need to use a form if there is at least one field other than the submit button.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  4. #4
    SitePoint Addict
    Join Date
    May 2011
    Posts
    242
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi Ralph,

    Could you please give me an example code of what you mean?

    Thanks a lot!!

  5. #5
    SitePoint Addict
    Join Date
    May 2011
    Posts
    242
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi felgall,

    Could you please give me an example code of what you mean?

    Thanks a lot!!

  6. #6
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,214
    Mentioned
    457 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by Sir_Arcturua View Post
    Could you please give me an example code of what you mean?
    Perhaps clarify what you are trying to do. On my first reading, it sounded like you needed a standard menu.

  7. #7
    SitePoint Addict
    Join Date
    May 2011
    Posts
    242
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Sure.

    All I need to do is to have a button for going from one page to the next one, and be able to pass variables from one page to the next one using $_POST.

    Thanks a lot!!

  8. #8
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,214
    Mentioned
    457 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by Sir_Arcturua View Post
    and be able to pass variables from one page to the next one using $_POST.
    OK, sounds like a job for the backend (PHP and all that). What data are you passing from one page to the next?

  9. #9
    SitePoint Addict
    Join Date
    May 2011
    Posts
    242
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    In this specific page I am passing nothing. Here you can see page I mean:

    http://www.libromania.cl/spanish/kent.shtml

    In this case the button just go from this page to the next one. It works fine for me and many people, but for a few, when press the button, nothing happens.

    It is like what is suggested here:
    http://stackoverflow.com/questions/1...on-not-working


    Thanks a lot!!!

  10. #10
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,837
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Either:

    Code:
    <a href="target_URL">Enter</a>
    or

    Code:
    <a href="target_URL"><button>Enter</button></a>
    would be a workable replacement for the original code posted.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  11. #11
    SitePoint Addict
    Join Date
    May 2011
    Posts
    242
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi felgall,

    I applied this suggestion, giving shape and colors with CSS.

    Thanks a lot!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •