Jump to content

Submit data from two GET forms


Omzy

Recommended Posts

It's an estate agent site - one form is at the top and specifies the sort order and how many results per page, the other form is at the side and lets you refine the property features. Naturally you'd want to retain one form's options when the other form is submitted.

Link to comment
Share on other sites

you can try this did not check it though

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
  <TITLE> New Document </TITLE>
   <script type="text/javascript">
        function consolidate() {
            form1 = document.getElementById('form1');
            form2 = document.getElementById('form2');
            form3 = document.getElementById('form3');
            
            form3.test.value = form1.test.value;
            form3.test1.value = form2.test1.value;

            form3.submit();
        }
   </script>
</HEAD>

<BODY>
  <form id="form1" onsubmit="consolidate(); return false;">
    <input type="text" name="test" value="2" />
    <input type="submit" value="submit1" />
  </form>


  <form id="form2"  onsubmit="consolidate(); return false;">
    <input type="text" name="test1" value="2" />
    <input type="submit" value="submit1" />
  </form>

  <form id="form3" >
    <input type="hidden" name="test" value="" />
    <input type="hidden" name="test" value="" />

  </form>

</BODY>
</HTML>

Link to comment
Share on other sites

Unless you use Javascript (your best bet) you'll have to use ONE FORM and make it span the entire body of your document...just to be safe.

 



</pre>
<form>

//Form One


//Form Two


</form>
<b

 

This way you can put as many submit buttons as you possibly need.. Then on your receiving page.. just check for which submit button they clicked.. since the other submit buttons will not be sent through... Though any fields that were filled in will still be sent.  It will give the illusion you are using multiple forms.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.