Forum Moderators: open
<form action="test.php" method="post">
Username<input type="text" name="uname" size="40" /><br />
Password<input type="password" name="pass" size="40" /><br />
Domain<input type="text" name="domain" size="40" /><br />
<input type="submit" value="Login!" />
</form>
You would then get these variables in test.php like this (with PHP that is):
echo $_POST["uname"].'<br />';
echo $_POST["pass"].'<br />';
echo $_POST["domain"].'<br />';
This of course only prints them to the browser. You would instead want to check to see if their credentials match. For more information about PHP and how it works, visit the PHP Forum [webmasterworld.com] here at WebmasterWorld.com. Good luck!
Here's what I'm trying to do.
I have a site where I am telling a user to copy and paste their code and fill in their affiliate id, domain name, and first and last name in certain areas. (it's kind of like an affiliate program)
Well, I thought, instead of them having to edit all these places themselves, I can just have them enter in their affiliate id, domain name and first and last name into three fields on my page and I would pop open another window where they can copy and paste this html code (with their id, name, and domain) already in there...
Does that make sense? Or would it help if I pasted the code? AHHH! thanks for all your help....
**Sammy :)
<html>
<head>
</head>
<body>
<script language='javascript'>
function print_code()
{
document.writeln("First:"+document.form1.first.value+"<br>Last:"+document.form1.last.value);}
</script>
<form name='form1'>
<input type='text' name='first'><br>
<input type='text' name='last'><br>
<input type="button" onClick="print_code()" value="test">
</form></body>
</html>
Good luck!
<html>
<head>
</head>
<body>
<script language='javascript'>
function print_code()
{
document.form2.text.value = "First:"+document.form1.first.value+"<br>Last:"+document.form1.last.value;
}</script>
<form name='form1'>
<input type='text' name='first'><br>
<input type='text' name='last'><br>
<input type="button" onClick="print_code()" value="Add Custom Values!">
</form><form name="form2">
<textarea name="text" cols="50" rows="30">Text to be copied</textarea>
</form></body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Get the code</title>
<script type="text/javascript">
function getCode() {
var str = 'name=' + document.getElementById('nm').value +
'&domain=' + document.getElementById('domain').value +
'&id=' + document.getElementById('aff_id').value;
str = str.replace(/ /g, '+'); // Convert spaces in name to encoded string.
// could also use str = str.replace(/ /g, '%20');
var day = new Date();
var id = day.getTime();
var msg = '<html><head><title>Your Code<\/title><\head><body><div style="text-align:center"><p><code>\n'+
str + '<\/code><\/p><form><input type="button" onClick="javascript:window.close();" value="Close Window">\n'+
'<\/form><\/div><\/body><\/html>\n';
var win = open('',id,'width=500,height=500,scrollbars,resizable');
win.document.write(msg);
win.document.close();
}
</script>
</head>
<body>
<form method="get" action="#" name="get_code" id="get_code" onSubmit="return false;">
<label for="aff_id">Your Name:</label> <input type="text" name="nm" id="nm" size="25" maxlength="150" value=""><br>
<label for="aff_id">Affiliate ID:</label> <input type="text" name="aff_id" id="aff_id" size="25" maxlength="150" value=""><br>
<label for="aff_id">Domain:</label> <input type="text" name="domain" id="domain" size="25" maxlength="150" value=""><br>
<input type="submit" onClick="getCode();" value="Get Code">
</form>
</body>
</html>