Taking info from one place and putting it in another

liunx

Guest
HI all,<br />
<br />
i was wondering if any one can help..<br />
<br />
<br />
i need to get information from the address bar into a HTML page, BUT its also got to be hidden so that the user can see it (ie it is his/hers username and password)<br />
<br />
so it should take "login=900&pass=900" from the address bar and stick it in a form, so i get it by email and can see what user submited what.<br />
<br />
hope yo can help..<br />
<br />
thanks..<br />
<br />
rossi<!--content-->Add two hidden fields to your form. The page will automatically update the fields for you.<br />
<form ...><br />
...<br />
<input type="hidden" name="login"><br />
<input type="hidden" name="pass"><br />
</form><br />
If for some reason they do not update automatically (maybe I am wrong), add this script in the head and use the body onload event to run it:<br />
<br />
<script><br />
function init() {<br />
if (window.location.search != "")<br />
{srch = window.location.search.substr(1).split("&");<br />
ary = new Array();<br />
for (var i=0; i<srch.length; i++)<br />
{tmp = srch.split("=");<br />
ary[tmp[0]] = tmp[1];}<br />
for (var i in ary)<br />
{document.formname.value = ary;} // fix "formname"<br />
}<br />
</script><br />
...<br />
<body ... onload="init()"><!--content-->the first one you gave me doesnt work!<br />
<br />
<br />
ill try the second option.<br />
<br />
thanks<!--content-->i cant get round the second one....<br />
<br />
do you understand what im trying todo??<br />
<br />
i want info from the address bar, ie i have written a CGI script that member processes info and keep them logged in, it shows the username and password (ie..<!-- m --><a class="postlink" href="https://secure.co.uk/cgi-bin/member.cgi?page=email&login=900&pass=900">https://secure.co.uk/cgi-bin/member.cgi ... 0&pass=900</a><!-- m -->)<br />
<br />
<br />
i want to take <br />
<br />
login=900&pass=900 <br />
<br />
and put it in my form in a hidden field, so that when the user submits, i will get there info in an email including username and password so i know who they!<br />
<br />
hope thats more help.<br />
<br />
thanks<br />
<br />
ross<!--content--><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"<br />
"http://www.w3.org/TR/html4/strict.dtd"><br />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><br />
<meta name="Content-Script-Type" content="text/javascript"><br />
<title>Example</title><br />
<br />
<script type="text/javascript"><br />
<!--<br />
onload = function () {document.forms[0].URL.value = self.location.search.replace(/^\?/, '')}<br />
// --><br />
</script><br />
<br />
<form action="" onsubmit="alert(this.URL.value); return false"><br />
<div><br />
<input name="URL" type="hidden"><br />
<button type="submit">Submit</button><br />
</div><br />
</form><br />
<br />
Just be aware, it will not do a thing for the 13% of users who do not use JavaScript.<!--content-->Here is a complete working example.<br />
<br />
<head><br />
<title>Loading hidden fields from a query</title><br />
<script><br />
function show() {<br />
alert("login = " + document.f1.login.value + "\npass = " + document.f1.pass.value);<br />
}<br />
<br />
function init() {<br />
if (window.location.search != "")<br />
{srch = window.location.search.substr(1).split("&");<br />
ary = new Array();<br />
for (var i=0; i<srch.length; i++)<br />
{tmp = srch.split("=");<br />
ary[tmp[0]] = tmp[1];}<br />
for (var i in ary)<br />
{document.f1.value = ary;}<br />
}<br />
show();<br />
}<br />
</script><br />
</head><br />
<body onload="init()"><br />
<form name="f1" onsubmit="return false"><br />
<input type="hidden" name="login" value=""><br />
<input type="hidden" name="pass" value=""><br />
</form><br />
</body><!--content--><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"<br />
"http://www.w3.org/TR/html4/strict.dtd"><br />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><br />
<meta name="Content-Script-Type" content="text/javascript"><br />
<title>Example</title><br />
<br />
<script type="text/javascript"><br />
<!--<br />
onload = function () {if (/name=([^&])+/.test(window.location.search)) document.forms[0].name.value = unescape(RegExp.$1); if (/password=([^&])+/.test(window.location.search)) document.forms[0].password.value = unescape(RegExp.$1)}<br />
// --><br />
</script><br />
<br />
<form action="" onsubmit="alert([this.name.value, this.password.value]); return false"><br />
<div><br />
<input id="name" type="hidden"><br />
<input id="password" type="hidden"><br />
<button type="submit">Submit</button><br />
</div><br />
</form><!--content-->charles the last ones no good, but the one you gave me befor is good, except it displas the who address bar! :rolleyes:<!--content-->Now none of them are working, can any one shed some light please??<br />
<br />
im confused!<!--content-->Originally posted by rossi <br />
Now none of them are working, can any one shed some light please??<br />
<br />
im confused! You are doing something wrong. Post the URL so that we can find it.<!--content-->hmm ok<br />
<br />
this is the head part:<br />
<br />
<html><br />
<head><br />
<title>Update Email Address - Telephone account</title><br />
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"><br />
<script type="text/javascript"> <br />
<!-- <br />
onload = function () {if (/name=([^&])+/.test(window.location.search)) document.forms[0].name.value = unescape(RegExp.$1); if (/password=([^&])+/.test(window.location.search)) document.forms[0].password.value = unescape(RegExp.$1)} <br />
// --> <br />
</script> <br />
</head><br />
<br />
<br />
and this is the body part:<br />
<br />
<tr><br />
<td width="251" height="1"><strong><font size="2" face="Verdana">Re-enter<br />
email address:</font></strong></td><br />
<td width="313" height="1"><font face="Verdana" size="1"><br />
<input TYPE="text" NAME="Email_confirm" onChange="setName()" size="41"><br />
</font></td><br />
</tr><br />
<tr><br />
<form action="" onsubmit="alert([this.name.value, this.password.value]); return false"> <br />
<div> <br />
<input id="name" type="hidden"> <br />
<input id="password" type="hidden"> <br />
<button type="submit">Submit</button> <br />
</div> <br />
</form><br />
</tr><br />
<tr><br />
<td width="251" height="1"></td><br />
<td width="313" height="1"></td><br />
</tr><br />
<tr><br />
<br />
<br />
<br />
Still not working, it did work then stopped!! hmm weird<!--content-->sorted was a fault on my end!<!--content-->
 
Back
Top