homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / WebmasterWorld / Webmaster General
Forum Library, Charter, Moderators: phranque & physics

Webmaster General Forum

How to make URL reflect form input

 11:43 pm on Nov 2, 2005 (gmt 0)

Hello everyone!

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:

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.



 11:54 pm on Nov 2, 2005 (gmt 0)

You output the form dynamically, with appropriate variables in the value fields. If the form is called without a query string, they will be blank (as the values are null.)

A perl-ey example:


%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>

<h3>Hello $qs{'name'}</h3>

<input type="text" name="name" value="$qs{'name'}">


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.


 11:57 pm on Nov 2, 2005 (gmt 0)

Thank you very much for your reply!

Is there any way I can do this with php or html?


 1:13 am on Nov 3, 2005 (gmt 0)

It seems that Vbulletin uses this kind of script to when you try to register. It asks you what your birthday is and then the next page displays as:
[forumname.com...] month=6&year=1984&day=2

Anybody know how else to do this? Thanks!


 1:22 am on Nov 3, 2005 (gmt 0)

Yes you can do it with PHP, no for just HTML as that is just a markup language, you need to use something in addition to HTML such as JavaScript, PHP, Perl, ASP etc. to fill in the field.
With your example of
then with PHP you would have
<input name="month" value="<? echo $month?>">


 1:31 am on Nov 3, 2005 (gmt 0)

Thanks, will try!


 5:44 pm on Nov 3, 2005 (gmt 0)

as I mentioned, you can do it in a static HTML page BUT you must use Javascript, VBscript, or some other client-side language.

Global Options:
 top home search open messages active posts  

Home / Forums Index / WebmasterWorld / Webmaster General
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved