How To Pass A Form Input To Another Page?

Discussion in 'HTML & Website Design' started by WallerBlog, Jan 23, 2009.

  1. #1
    I am in the middle of building a site. On the site there is a pseudo search box that will always direct to the same page no matter what is entered.

    The code I currently have for the form is
      <form name="form1" id="form1" method="post" action="http://abc.com/go.htm">
        <input type="text" name="textfield" />
        <strong><a href="http://abc.com/go.htm">SEARCH</a></strong>
      </form>
    Code (markup):
    Now on go.htm I want to display what was entered in the search box above. Currently I have:
    <div id="loader">
    	<div id="title">Searching database for "Whatever was entered in the search box"...</div>
    	<img src="../../start/loader.gif" width="393" height="17" id="loadbar" />
    	<div id="results"></div>
    </div>
    Code (markup):
    So if "bunnies" was typed in the search box, the loading page would display "Searching database for bunnies..."

    How would I do this?
     
    WallerBlog, Jan 23, 2009 IP
  2. fundu

    fundu Well-Known Member

    Messages:
    1,230
    Likes Received:
    68
    Best Answers:
    0
    Trophy Points:
    185
    Digital Goods:
    2
    #2
    In php, use can use session variables to pass input to another page. But for HTML, only way you can pass variable to another page is by using cookies. Though I'm not sure about this. Some one please correct me if I am wrong.
     
    fundu, Jan 23, 2009 IP
  3. mahendras

    mahendras Peon

    Messages:
    597
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You have to use server side script like PHP or ASp.net or JSP to take the value from one page to other. because you just dont want to take value from one to other page but I am sure you want to process that value too.
    By processing i mean you will search database for searched keyword or you will gather data and insert to database.
    for all this, you need to use above languages.
     
    mahendras, Jan 23, 2009 IP
  4. WallerBlog

    WallerBlog Peon

    Messages:
    157
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I actually don't need to process the variable. This isn't a true search function, just a pseudo page to make the site feel deeper than it really is. All I need to do with the variable is display it on the following page.

    I don't mind using php or javascript. Just need someone who can code better than I to give some guidance.
     
    WallerBlog, Jan 23, 2009 IP
  5. hcbeggar

    hcbeggar Member

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #5
    Hey,
    I was bashing my brains against this all week until I came accross this site
    h**p://www.htmlgoodies.com/beyond/javascript/article.php/3471111

    You will have to fix the http above cause I dont think I am allowed to post links yet. It totally worked for me and I just altered fields and certain texts. Maybe this can help
    ~eric
     
    hcbeggar, Jan 24, 2009 IP