Forums

How to read url session data to put into 2nd page form

falcos 05 Feb, 2010
Hi,

I am passing a field to a second form. My url after submitted looks like this:

http://www.domainname.com/quote.html?zipcode=090210

How do I get that 'zipcode' data to populate the zipcode field on my second form?

Been rackin my head on this all day -- just want a simple way of doing this. 🙄

Tx
GreyHead 05 Feb, 2010
Hi falcos,

Try
<?php
$zipcode = JRequest::getString('zipcode', '', 'get');
?>

Bob
falcos 05 Feb, 2010
Am I putting that in the FORM HTML code on the second page?

How do I show it in the zipcode field?

value=?????
falcos 05 Feb, 2010
Bob,
Actually I have it working with a test.html document that has the following code in it, my issue is how/where do I put this info into chrono??? Does chrono change the form names on it's own?

<FORM NAME="formname">
<INPUT TYPE="text" NAME="zipcode">
<INPUT TYPE="submit">
</FORM>

<SCRIPT LANGUAGE="JavaScript"><!--
function getParm(string,parm) {
    // returns value of parm from string
    var startPos = string.indexOf(parm + "=");
    if (startPos > -1) {
        startPos = startPos + parm.length + 1;
        var endPos = string.indexOf("&",startPos);
        if (endPos == -1)
            endPos = string.length;
        return unescape(string.substring(startPos,endPos));
    }
    return '';
}

var passed = location.search.substring(1);

document.formname.zipcode.value = getParm(passed,'zipcode');

//--></SCRIPT>
GreyHead 05 Feb, 2010
Hi falcos,

Using JavaScript is a very complicated way of doing it.

You add it to the input value as you suggested.
<input . . . value='<?php echo $zipcode; ?>' />

Bob

Or you can use the ChronoForms multi-page plugin which will handle most of it for you.
falcos 05 Feb, 2010
Bob,
You just made my day. What you showed me worked perfectly. I dismissed all the javascript.

Thank you very much for this. 😀

Steve
This topic is locked and no more replies can be posted.