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.

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>

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.