Forum Moderators: phranque
I would like to know if there is a way to make whatever the URL used to get to a page is, reflect on the input of a form on that page. I know most of you are going "huh?" right now, so allow me to explain.
A user goes to a URL like:
http://www.example.com/member.php?name=John
On the member.php page, there is a form and one of the inputs is "name".
So when the page loads, "John" will already be in one of the form's fields.
I hope this is not too confusing, and thanks in advance for any assistance.
A perl-ey example:
http://www.example.com/member.cgi?name=John
%qs = &query; ## Read/parse, associates $qs{'name'} = 'John';
print "content-type: text/html\n\n";
print <<"EOFORM";
<html><head><title>Hello $qs{'name'}</title></head></html>
<body>
<h3>Hello $qs{'name'}</h3>
<form>
<input type="text" name="name" value="$qs{'name'}">
</form>
</body>
</html>
EOFORM
You can do this using the language of your choice, or if on a static page, with Javascript or VBScript. The methods will differ, but the concept is the same, parse a query string/form post and use the variables to populate the form.
Anybody know how else to do this? Thanks!