Take the 2-minute tour ×

Please see the code in this pastebin: http://pastebin.com/5gKwb7gi

It is quite a lot of code but I think all you gurus on here will understand it!

Basically what I have just confused myself is, I had a search form, and I then created an advanced search form which is dynamic.

I just got it finished and now I am attempting to include the simple search criteria (if it is filled out) in the advanced search query but obviously these variables are never set because the simple search form is never submitted :S

Does anyone have any hints, tips or ideas on what to do? Not sure if I want to combine the forms or not so I would appreciate some advice and opinions.


share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

If anyone reads this question and would like to know how I solved it, I used hidden inputs and some JQuery to copy the values from the simple search form to the hidden inputs like so:

<input type="hidden" name="hiddenfilename" id="hiddenfilename"/>
<input type="hidden" name="hiddenfilesize_min" id="hiddenfilesize_min"/>
<input type="hidden" name="hiddenfilesize_max" id="hiddenfilesize_max"/>

<script type="text/javascript">

function copyFilename()
   var valueToCopy=$("#filename").val();

function copyFileSizeMin()
   var valueToCopy=$("#filesize_min").val();

function copyFileSizeMax()
   var valueToCopy=$("#filesize_max").val();
share|improve this answer
add comment

I will not read 600 lines of code to help you. Make the example smaller that you can express it with some words and less then 50 lines. That is always possible! Anyway, I answer from what I read here without the code.

If you want to get Data for a multipage form you have several options. You can evaluate each page of your form server side, and then just put them back where you want to have them in the second step (use hidden import tags for variables, which should not be rendered). Another choice is to put the values into a cookie and take it from there when you need it. Also you can change the structure of your form with Javascript according to the user inputs and then just send the whole thing, when he is finished (maybe per AJAX). The most basic but often also most elegant one is the first one. For learning purposes I advice that one. Combining cookies and AJAX should be the highest level and the one used most often, but also the most complicated one, because you need to learn how your server and your php code handles cookies and also how to apply Javascript correctly.

share|improve this answer
add comment

Your Answer


