/    Sign up×
Community /Pin to ProfileBookmark

Taking info from one place and putting it in another

HI all,

i was wondering if any one can help..

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)

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.

hope yo can help..

thanks..

rossi

to post a comment
HTML

11 Comments(s)

Copy linkTweet thisAlerts:
@gil_davisNov 12.2003 — Add two hidden fields to your form. The page will automatically update the fields for you.
<form ...>
...
<input type="hidden" name="login">
<input type="hidden" name="pass">
</form>

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:
<i>
</i>&lt;script&gt;
function init() {
if (window.location.search != "")
{srch = window.location.search.substr(1).split("&amp;");
ary = new Array();
for (var i=0; i&lt;srch.length; i++)
{tmp = srch[i].split("=");
ary[tmp[0]] = tmp[1];}
for (var i in ary)
{document.formname[i].value = ary[i];} // fix "formname"
}
&lt;/script&gt;
...
&lt;body ... onload="init()"&gt;
Copy linkTweet thisAlerts:
@rossiauthorNov 12.2003 — the first one you gave me doesnt work!


ill try the second option.

thanks
Copy linkTweet thisAlerts:
@rossiauthorNov 12.2003 — i cant get round the second one....

do you understand what im trying todo??

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..https://secure.co.uk/cgi-bin/member.cgi?page=email&login=900&pass=900)


i want to take

login=900&pass=900[/QUOTE]

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!

hope thats more help.

thanks

ross
Copy linkTweet thisAlerts:
@CharlesNov 12.2003 — [font=monospace]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"

"http://www.w3.org/TR/html4/strict.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<meta name="Content-Script-Type" content="text/javascript">

<title>Example</title>

<script type="text/javascript">

<!--

onload = function () {document.forms[0].URL.value = self.location.search.replace(/^?/, '')}

// -->

</script>

<form action="" onsubmit="alert(this.URL.value); return false">

<div>

<input name="URL" type="hidden">

<button type="submit">Submit</button>

</div>

</form>[/font]

[font=georgia]Just be aware, it will not do a thing for the 13% of users who do not use JavaScript.[/font]
Copy linkTweet thisAlerts:
@gil_davisNov 12.2003 — Here is a complete working example.
<i>
</i>&lt;head&gt;
&lt;title&gt;Loading hidden fields from a query&lt;/title&gt;
&lt;script&gt;
function show() {
alert("login = " + document.f1.login.value + "npass = " + document.f1.pass.value);
}

function init() {
if (window.location.search != "")
{srch = window.location.search.substr(1).split("&amp;");
ary = new Array();
for (var i=0; i&lt;srch.length; i++)
{tmp = srch[i].split("=");
ary[tmp[0]] = tmp[1];}
for (var i in ary)
{document.f1[i].value = ary[i];}
}
show();
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body onload="init()"&gt;
&lt;form name="f1" onsubmit="return false"&gt;
&lt;input type="hidden" name="login" value=""&gt;
&lt;input type="hidden" name="pass" value=""&gt;
&lt;/form&gt;
&lt;/body&gt;
Copy linkTweet thisAlerts:
@CharlesNov 12.2003 — [font=monospace]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"

"http://www.w3.org/TR/html4/strict.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<meta name="Content-Script-Type" content="text/javascript">

<title>Example</title>

<script type="text/javascript">

<!--

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)}

// -->

</script>

<form action="" onsubmit="alert([this.name.value, this.password.value]); return false">

<div>

<input id="name" type="hidden">

<input id="password" type="hidden">

<button type="submit">Submit</button>

</div>

</form>[/font]
Copy linkTweet thisAlerts:
@rossiauthorNov 12.2003 — charles the last ones no good, but the one you gave me befor is good, except it displas the who address bar! :rolleyes:
Copy linkTweet thisAlerts:
@rossiauthorNov 13.2003 — Now none of them are working, can any one shed some light please??

im confused!
Copy linkTweet thisAlerts:
@CharlesNov 13.2003 — [i]Originally posted by rossi [/i]

[B]Now none of them are working, can any one shed some light please??



im confused! [/B]
[/QUOTE]
[font=georgia]You are doing something wrong. Post the URL so that we can find it.[/font]
Copy linkTweet thisAlerts:
@rossiauthorNov 13.2003 — hmm ok

this is the head part:

<html>

<head>

<title>Update Email Address - Telephone account</title>

<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">

<script type="text/javascript">

<!--

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)}

// -->

</script>

</head>


and this is the body part:

<tr>
<td width="251" height="1"><strong><font size="2" face="Verdana">Re-enter
email address:</font></strong></td>
<td width="313" height="1"><font face="Verdana" size="1">
<input TYPE="text" NAME="Email_confirm" onChange="setName()" size="41">
</font></td>
</tr>
<tr>

<form action="" onsubmit="alert([this.name.value, this.password.value]); return false">

<div>

<input id="name" type="hidden">

<input id="password" type="hidden">

<button type="submit">Submit</button>

</div>

</form>

</tr>

<tr>

<td width="251" height="1"></td>

<td width="313" height="1"></td>

</tr>

<tr>



Still not working, it did work then stopped!! hmm weird
Copy linkTweet thisAlerts:
@rossiauthorNov 13.2003 — sorted was a fault on my end!
×

Success!

Help @rossi spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.14,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...