Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Submit form and stay on page

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #185922
    justdan
    Participant

    Quick question guys. I’m curious to see how other people handle this or if anyone has any good info to read up on. I need a way to stay on the page after a form has been submitted. Everything I seem to read online seems to be more geared towards PHP, I’m using just a place HTML form. Then again, I’m a bit of a novice with dealing with forms so maybe that’s it and I don’t even know. Any help to get me in the right direction is helpful. Thanks guys.

    #185931
    shaneisme
    Participant

    When you set up a <form> with an action you can set it to the URL you want (including the page you’re at). Now, the method tells the browser if you want to append the form data to the URL (get) or save it into a special variable (post).

    If you wanted to submit the form without a post-back, you’ll want to look into AJAX form submits. This does stuff in the background and starts a process in the background without leaving the page at all.

    All that said, what are you doing with the data inputted in the form?

    #185941
    shaneisme
    Participant

    OK, if you’re passing it into another form, what then?

    Is it calculating something, or … ?

    #185974
    shaneisme
    Participant

    I’m asking because if the end game is to store it in a MySQL database or something and you’re just breaking up a form into smaller bits, you should just use whatever server-side language you’ve got.

    It’ll be cleaner and more secure.

    You can either store it into the database right away (which I do sometimes), or you can just keep it in a $_SESSION variable (since you mentioned PHP)… there’s a lot of ways you can skin the form in this case.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.