Chat LIVE With Programming Experts! There Are 23 Online Right Now...

Welcome to Dream.In.Code
Become an Expert!

Join 244,309 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 861 people online right now. Registration is fast and FREE... Join Now!




Capture URL parameters in a form page

 
Reply to this topicStart new topic

Capture URL parameters in a form page, Getting one pages parameters into another pages text box.

TTope
2 Oct, 2008 - 09:04 AM
Post #1

New D.I.C Head
*

Joined: 2 Oct, 2008
Posts: 1

I have a page http://www.anywhere.com/contact.htm?locid=...scription=front

I would like to capture the parameters and add each to its own hidden textbox.

CODE

<head>

<meta http-equiv="Content-Language" content="en-us"/>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>

<title>Contact Information</title>

<script type="text/javascript">
var qsParm = new Array();
function qs() {
var query = window.location.search.substring(1);
var parms = query.split('&');
for (var i=0; i<parms.length; i++) {
var pos = parms[i].indexOf('=');
if (pos > 0) {
var key = parms[i].substring(0,pos);
var val = parms[i].substring(pos+1);
qsParm[key] = val;
}
}
}
qsParm['locid'] = null;
qsParm['unitid'] = null;
qsParm['description'] = null;
qs();
</script>
</head>

<body>

<form title="contact" method="POST" action="contacthandler.asp" target="_parent" xml:lang="en-us">

    <table border="1" width="100%" style="border-top-style: none; border-right-style: none; border-left-style: none; border-bottom-style: none">
    <tr>
    <td align="right" style="width: 209px; border-top-style: none; border-right-style: none; border-left-style: none; height: 28px; border-bottom-style: none; text-align: center;"><input type="hidden" name="locid" style="width: 95px" /></td>
    <td align="left" style="width: 77px; border-top-style: none; border-right-style: none; border-left-style: none; border-bottom-style: none; text-align: center;"><input type="hidden" name="description" style="width: 95px"/></td>
    <td align="left" style="width: 162px; border-top-style: none; border-right-style: none; border-left-style: none; border-bottom-style: none; text-align: center;"><input type="hidden" name="unitid"  style="width: 95px"/></td>
    </tr>
    </table>

</form>

</body>

</html>


User is offlineProfile CardPM
+Quote Post


gabehabe
RE: Capture URL Parameters In A Form Page
2 Oct, 2008 - 10:08 AM
Post #2

i > u
Group Icon

Joined: 6 Feb, 2008
Posts: 7,381



Thanked: 154 times
Dream Kudos: 2850
Expert In: Lots of things.

My Contributions
Moved to JavaScript. smile.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 7/4/09 07:10PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month