5 Replies Latest reply on Mar 27, 2009 9:31 AM by Albert S.

    Passinf Form variables without ?id=

    (Laurence_Lewis) Level 1
      Hi<br /><br />I have a mix of ADDT and non ADDT form ages.<br /><br />The pages are a multi part form where each part of the form submits to a new page with the previous page form details passes as variables like so<br /><br /><?php<br />    $gradeselection = htmlentities($_POST['gradeselection']);<br />     ?><br /><br />and passed as a hidden field<br /><br /><INPUT TYPE="hidden" name="cust_email"<br />VALUE="<?php echo $gradeselection; ?>"><br /><br />Then on the final page everything is submitted to the DB table.<br /><br />Part of the form requires a file upload which I am using the ADDT part of the form. However the $_POST does not pass the form file field to the next page unless I append a .php?id=. The trouble with that is it stops the other form $_POST variable being passed.<br /><br />So my question is how do I pass the ADDT form field variable?<br /><br />Cheers<br />Laurence
        • 1. Re: Passinf Form variables without ?id=
          Günter Schenk Level 4
          Hi Laurence,

          as the value (aka the flle name) of the form´s file field is part of the transaction, you can pass this one (like any other transaction value) to a subsequent page using ADDT´s dynamic data placeholder, e.g.

          pagename.php?filename={column_name}

          Not sure if this is what you´re looking for ;-)

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: Passinf Form variables without ?id=
            (Laurence_Lewis) Level 1
            Hi Gunter <br /> <br />Its been a while since I was in the forum. I hope you are well. <br />I know I can do it pssing the dynamic data placeholder. I was attempting to get the same result using $_POST and a hidden field. <br /> <br />This works well in non ADDT formsbut does not seem to with ADDT forms. <br /> <br />To do this normally I use the following code in a include file <br /> <br />***CODE**** <br /><?php<br />function field_forwarder() {<br />    global $_POST, $rEM979, $FFoutputType;<br />    $fieldForwarder = '';<br />    /* get the arguments passed */<br />    $argList = func_get_args ();<br /><br />    /* globalize any other set of instructions */<br />    if (count ($argList)) {<br />        eval ('global $' . $argList[count($argList)-1] . ';');<br />    }<br />    <br />    /* set the default set of values to convert */<br />    if(count($argList)==0) {<br />        /* if the function is initially passed without<br />           parameter we're looking in $_POST */<br />        $argList[0] = '_POST';<br />        $startValue = $_POST; <br />        if (sizeof ($startValue) == 0) {<br />            return false;<br />        }<br />    } elseif (count ($argList) == 1) {<br />        eval ('$rEM979["' . $argList[0] . '"] = $' <br />              . $argList[0] . ';');<br />        $argList[0] = 'rEM979';<br />        $startValue = $rEM979;<br />    } elseif (count ($argList) == 2) {<br />        eval ('$startValue = $' . $argList[1] . '["' <br />              . $argList[0] . '"];');<br />    } else {<br />        for($e = count($argList) - 2; $e >= 0; $e--) {<br />            $intersperse .= '["' . $argList[$e] . '"]';<br />        }<br />        eval ('$startValue = $' . $argList[count($argList)-1]  <br />              . $intersperse . ';');<br />    }<br /><br />    foreach($startValue as $n => $v) {<br />        if (is_array ($v)) {<br />            /* call the function again */<br />            $shiftArguments = '';<br />            for($w = 0; $w <= count ($argList) - 1; $w++) {<br />                $shiftArguments .= '"' . $argList[$w] . '", ';<br />            }<br />            $shiftArguments = substr ($shiftArguments, 0, <br />                                     strlen ($shiftArguments) - 2);<br />            <br />            eval ('$fieldForwarder .= field_forwarder("' . $n . '"' <br />                  . substr(',',0,strlen($shiftArguments)) . ' ' <br />                  . $shiftArguments . ');');<br />                        <br />        } else {<br />            /* we have an root value finally */<br />            if (count ($argList) == 1) {<br />                /* actual output */<br />                flush();<br />                if ($FFoutputType == 'print') {<br />                    $fieldForwarder .= "\$$n = '$v';\n";<br />                } else {<br />                    $fieldForwarder .= "<input type=\"hidden\" "<br />                                    . "name=\"$n\" value=\"" <br />                                    . htmlentities(stripslashes($v)) <br />                                    . "\">\n";<br />                }<br />            } elseif (count ($argList) >1 ) {<br />                $indexString = '';<br />                for($g = count ($argList) - 3; $g >= 0; $g--) {<br />                    $indexString .= '[' <br />                                 . ((!is_numeric ($argList[$g])<br />                                 and $FFoutputType == 'print')<br />                                 ? "'" : '')<br />                                 . $argList[$g]<br />                                 . ((!is_numeric ($argList[$g])<br />                                 and $FFoutputType == 'print')<br />                                 ? "'" : '')<br />                                 . ']';<br />                }<br />                $indexString .= '[' <br />                             . ((!is_numeric ($n) <br />                             and $FFoutputType == 'print') <br />                             ? "'" : '') . $n <br />                             . ((!is_numeric ($n) <br />                             and $FFoutputType == 'print') <br />                             ? "'" : '') . ']';<br />                /* actual output */<br />                flush();<br />                if ($FFoutputType == 'print') {<br />                    $fieldForwarder .= "\${$argList[count($argList)-2]}"<br />                                    . "$indexString = '$v';\n";<br />                } else {<br />                    $fieldForwarder .= "<input type=\"hidden\" name=\""<br />                                    . "{$argList[count($argList)-2]}"<br />                                    . "$indexString\" value=\"" <br />                                    . htmlentities(stripslashes($v)) <br />                                    . "\">\n";<br />                }<br />            }<br />        }       <br />    }<br />    return $fieldForwarder;<br />}<br />?> <br />*****END CODE*** <br /> <br />In the head of the receiving page I would have something like <br /> <br /><?php<br />    $gradeselection = htmlentities($_POST['gradeselection']);<br /> ?> <br /> <br />and in the body <br /> <br /><?php echo field_forwarder(); ?> <br /> <br />This passes all the previous form fields as variables. <br /> <br />Only does not work with ADDT form fields :-( <br /> <br />Cheers <br />Laurence
            • 3. Re: Passinf Form variables without ?id=
              (Laurence_Lewis) Level 1
              Hi again Gunter and Albert

              I have decided to trash everything and start again :-)
              I can get too complicated for my own good sometimes.

              This is what I want to try, do you think it will work

              Form one has an insert record form which submits to DB table 1 ID1 and to page form part 2

              $ins_INDship->registerTrigger("END", "Trigger_Default_Redirect", 99, "page2.php?id_imship={id_imship}");

              form 2 has an Update record where it adds the new entrries into table 1 ID1

              Okay here is the problem I am not passing the page correctly so I get

              php?id_imship=%7Brscustom.id_imship%7D and not

              php?id_imship=1

              CAn you possibly anser my demented questions without going insane :-)

              Cheers
              Laurence
              • 4. Re: Passinf Form variables without ?id=
                (Laurence_Lewis) Level 1
                Hahahhaha it works just needed to change

                $ins_INDship->registerTrigger("END", "Trigger_Default_Redirect", 99, "page2.php?id_imship={id_imship}");

                to

                $upd_INDship->registerTrigger("END", "Trigger_Default_Redirect", 99, "supporting-documents.php?id_imship={GET.id_imship}");

                WOOT its great when things come together
                • 5. Re: Passinf Form variables without ?id=
                  Albert S. Level 3
                  Hi Laurence,

                  Good job!