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

passing zip code from another form


  1. rssolo23
    Member

    Hello,

    I'm trying to pass a zip code from another page onto the MachForm zip code field (strongly preferred within the pre-defined address). I've created the php session and passed the value from another page:

    http://my.website.com/contact.php?zipcode=90210 (for example)

    The header on my contact.php form is:

    <?php
    session_start();
    $_SESSION['zipcode'] = $_GET['zipcode'];
    ?>

    The code I'm placing on my view-fuctions.php (somewhere around line 1390):

    if (!empty($_SESSION['zipcode']) && empty($element->populated_value['element_'.$element-id.'_5']['default_value'])) {
    $element->default_value = $_SESSION['zipcode'];
    }

    I know i'm probably pasting the wrong code in the view-functions.php (and noticed that the zip code field doesn't have a default_value within the element associated to it), but I'm hoping you're able to provide me with an easy fix. Thank you!

    Posted 14 years ago #
  2. redityo

    Hi,

    I think the wrong code on this line

    $element->default_value = $_SESSION['zipcode'];

    Try to go around line 1401 for this code :

    $element_markup = <<<EOT

    and put these code above that line

    if (!empty($_SESSION['zipcode']) && empty($element->populated_value['element_'.$element->id.'_5']['default_value'])) {
    	$element->populated_value['element_'.$element->id.'_5']['default_value'] = $_SESSION['zipcode']
    }

    MachForm Support

    Posted 14 years ago #
  3. rssolo23
    Member

    Excellent, that's exactly what I needed, and it worked. Thank you!

    Posted 14 years ago #

RSS feed for this topic

Reply