1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Insert form results to a hidden field...

Discussion in 'C#' started by MALHYP, May 31, 2006.

  1. #1
    Heya, I have a page search.asp with a form in it which has text and list menus.

    Text Fields: KeywordSearch
    List Menu: CategoryTable
    List Menu: Location
    Button: Search

    When you submit the search button the search.asp page directs to the results.asp page with the search result.

    Going back to the search.asp page. I would like to create a second form on the same page which would have 4 hidden text fields.

    Hidden Field: KeywordSearch, CategoryTable, Location, UserName.

    Is it possible to pass the entered information from the Text Fields and List Menu to the Hidden Fields?

    The reason for wanting to do this is so that I can create an Insert Record. When submitting from the search page, the insert record will also submit to a database which will show me what the users are searching for.

    Tanks Heaps

    Mally:)
     
    MALHYP, May 31, 2006 IP
  2. fluid

    fluid Active Member

    Messages:
    679
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    70
    #2
    You can use Javascript to set the form fields when the user submits the form.

    Say for example, your first form is f1 and 2nd form is f2.
    <form name="f2" ...
    <input type="hidden" name="hidden_keyword" value="" />
    ....
    </form>
    <script language="javascript">
    function setHiddenFieldValues()
    {
    document.f2.hidden_keyword.value = document.f1.keyword.value;
    ....
    }
    </script>

    On submitting your form, you should trigger this function (same as you perform form checks)
     
    fluid, Jun 1, 2006 IP