forms posting to another part of form

Status
Not open for further replies.

97lt2959

In Runtime
Messages
169
OK, This is purley javascript/html stuff please....

Basically i have some code:

PHP:
<form method=POST action="http://xxxxxxxx/cgi-bin/formprocessing/forms.pl">
<input type=hidden name="activenumber" value="xxxxxxxx">
<input type="hidden" name="username" value="xxxxxxx">
<input type="hidden" name="subject" value="username and password">
<input type="text" name="UserName" size="20">


<input type="text" name="Password" size="50">


  <input type="submit" value="Submit" name="Submit"></p>
</form>

What i want to do is replace the subject value with the username and password entered in the UserName & Password fields.

Any Ideas????

Thanks In Adavance :)
 
I don't see the point in doing that. Because the username and password, is going to be submitted anyways, and where you'll need it you'll just use

$_POST['UserName'] + $_POST['Password'] or however you do it, in the language your working in. (this was php)

bUUuuutt.... if you must, which you shouldn't, cause somepeople might have javascript turned off. you can use the onClick() event, on the Submit button, that goes to a function, that changes the hidden field subjects value...

you'll need ID tags on your fields, id="subject", etc. you'll do something like...


function changeSubject(){
var subject = document.getElementById("subject");
var username = document.getElementById("username");
var password = document.getElementById("password");
subject.value = username+" and "+password;
return true;
}

or something like this... haven't jscripted in a whilez...

Microsoft DHTML Reference
 
well right now you're already pulling the username from a variable in the site, becuase it's hidden. cookies, or another script.

you could just add some lines to your perl script your submitting the form to to make the user / pass as part of the subject.

but 1 problem. are you able to view the password as it is? becuase that's insecure to the users, you should encrypt it :)
 
OK, its working sort of im getting an email through saying ibn the subject line [object] and [object] instead of getting a blank subject line.

This is the code i have so far:

PHP:
<SCRIPT LANGUAGE="JavaScript">
 function changeSubject(){
 var subject = document.getElementById("subject");
 var username = document.getElementById("username1");
 var password = document.getElementById("password");
 subject.value = username+" and "+password;
return true;
}
</script>

<FORM onClick="changeSubject()" method=POST action="http://fp1.xxxxx.com/cgi-bin/fmxxx">
<input type="hidden" name="subject" ID="subject" value="">
<input type="text" name="UserName1" ID="username1" size="20">
<input type="text" name="Password" ID="password" size="50">
  <input type="submit" value="submit" name="Submit"></p>
</form>

Any Ideas??? I have a feeling its staring me in the face but i really aint got a clue:confused:
 
<SCRIPT LANGUAGE="JavaScript">

function changeSubject(){

var subject = document.getElementById("subject");

var username = document.getElementById("username1");

var password = document.getElementById("password");

subject.value = username+" and "+password;

return true;

}

</script>

my bad it should be

<SCRIPT LANGUAGE="JavaScript">

function changeSubject(){

var subject = document.getElementById("subject");

var username = document.getElementById("username1");

var password = document.getElementById("password");

var username = username.value;

var password = password.value;

subject.value = username+" and "+password;

return true;

}

</script>

Yeup perl is where you should do it. Because people might have jscript disabled... and older browsers might not support it... like one set's of code might work in IE, but not Mozilla, or Opera. I find myself writing 2 sets of code most of the time, one for IE, and another for Mozilla... so yeup, Perl is where you should do it.
 
Status
Not open for further replies.
Back
Top Bottom