how do I send value of textbox without using form tag and submit button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • oranoos3000
    New Member
    • Jan 2009
    • 107

    how do I send value of textbox without using form tag and submit button

    hi
    I want to send value of textbox without using form tag and submit button to another page? Is it possible with php ?
    How do I get this thing work?
    thanks alot
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Originally posted by oranoos3000
    hi
    I want to send value of textbox without using form tag and submit button to another page? Is it possible with php ?
    How do I get this thing work?
    thanks alot
    PHP does not interact directly with the browser. You'll need to use javascript to obtain the value of the textbox and then append it to the url (mimic GET).

    I don't understand why you cannot use a form - they're there for the purpose of passing data to pages.

    Comment

    • TheServant
      Recognized Expert Top Contributor
      • Feb 2008
      • 1168

      #3
      Is it just to the following page? How does the user move to the next page? Seeing as you are not using a form (no $_POST), you have to use $_GET, as has already been said. I guess you could probably use AJAX to save the data in a database somehow so it can be called as a session variable on the next page, but using a form would be heaps easier!

      Comment

      • oranoos3000
        New Member
        • Jan 2009
        • 107

        #4
        hi
        thing that I want to do this is after write in textbox and without click button
        value of textbox is send to next page without this value is added to url
        I want to do this work with php and javascript without ajax
        Is this possible?
        thanks lot

        Comment

        • Dormilich
          Recognized Expert Expert
          • Aug 2008
          • 8694

          #5
          Originally posted by oranoos3000
          [...]
          Is this possible?
          in simple words: no.

          Comment

          • TheServant
            Recognized Expert Top Contributor
            • Feb 2008
            • 1168

            #6
            To elborate on Dormilich's reply:
            PHP is server side, as in once the page has been sent to the browser from the server, PHP is useless and has no control. PHP can process forms, use variables etc...
            Javascript is the opposite. It only works once the page is sent and is entirely reliant on the browser. It can be used to auto fill forms and even submit forms for you. Because it is browser dependant, if your visitor has turned off javascript, is will not work at all.
            AJAX is between these forms, so it can auto submit forms, process variables etc... It's simply an extension of javascript, so if you know javascript, AJAX isn't that much more work.

            As I said, it is possible to submit forms on events, but it will require some user input like click a button or mousin/mouseout. Use google to find out how to submit forms with javascript to get an idea.

            If you explain why you have all these restrictions we can tell you better ways to do it, because often there is a simpler way... Which we can only reveal if we know the problem.

            Comment

            Working...