This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Referring URL in form


  1. alanbrown
    Member

    Hope I explain this properly.....I have to design a simple booking for a holiday lettngs site. No problem there, however to avoid having to have a seperate form foreach property is there a way of using one form but populating a field with the name of the property which would be taken from the referring URL for example, or is there another way? The customers receiving this booking form could be simply sent a link of some sort so long as when mu customer receives the booking form he knows which property is being booked. hope I have made this clear...if not then tell me and I will try again. Thanking you all in advance.

    Posted 15 years ago #
  2. yuniar

    Yes, basically you need to apply this modification:
    http://www.appnitro.com/forums/topic/dynamic-content-php?replies=20

    or this:
    http://www.appnitro.com/forums/topic/adding-hidden-variables-to-machforms?replies=2

    In your case, simply pass the referring URL as the parameter to your form.

    If you are having difficulty, send us an email and let us know some example URL of your current page. We'll help you there.


    MachForm Founder

    Posted 15 years ago #
  3. alanbrown
    Member

    Brilliant...I used the first suggested soluton and its great..however...can I do this for more than one form ID. I tried to enter another line of code identical to one that worked and I got an error, unexpected $ send I think.. SO how do I do this for two seperate forms with different ID's?

    Cheers

    Posted 15 years ago #
  4. yuniar

    That seems to be some syntax error. Make sure to copy the whole code, including the curly braces.

    Like this:

    if($form_id == 5 && $row['element_id'] == 3){
    	$element[$j]->default_value = $_GET['email'];
    }
    
    if($form_id == 6 && $row['element_id'] == 3){
    	$element[$j]->default_value = $_GET['email2'];
    }
    
    if($form_id == 7 && $row['element_id'] == 3){
    	$element[$j]->default_value = $_GET['email3'];
    }

    MachForm Founder

    Posted 15 years ago #
  5. alanbrown
    Member

    This is the exact code I have put in:-

    $element[$j]->default_value = htmlspecialchars($row['element_default_value']);

    if($form_id == 4 && $row['element_id'] == 1){
    $element[$j]->default_value = $_GET['property'];
    }

    if($form_id == 11 && $row['element_id'] == 1){
    $element[$j]->default_value = $_GET['property'];
    }

    However only Form 11 works, form 4 will not take the data. The element ID is correct but o no avail. What am I doing wrong?

    Posted 15 years ago #
  6. alanbrown
    Member

    Just to clarify, I didn't enter the

    $element[$j]->default_value = htmlspecialchars($row['element_default_value']);

    Just the two lines of code below it. Still dont understand..........

    Posted 15 years ago #
  7. alanbrown
    Member

    The two pages are these:-

    www.gotokefalonia.com/machform/view.php?id=11&property=test ( a simple form to test this method worked for me)

    and

    www.gotokefalonia.com/machform/view.php?id=4&property=test (a form I started to design erlier which simply will NOT pick up the string 'test')

    Posted 15 years ago #
  8. alanbrown
    Member

    OK....sorted. It seems the forms I designed earlier just wouldn't take the data but any new forms will! Anyway, all good and working now. Thank you for your help but this thread can now end. Cheers

    Posted 15 years ago #
  9. yuniar

    That sounds great :-)


    MachForm Founder

    Posted 15 years ago #

RSS feed for this topic

Reply