Click here to get back home

How to do this? Form fill problem

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
How to do this? Form fill problem Moozie 05-08-2005
Get Chitika Premium
Posted by Moozie on May 8, 2005, 6:35 am
Please log in for more thread options


I have a form that people can fill out.

Link looks like:
http://www.myname.com/form.php
A regular form, nothing special.

Now I would like to fill out 1 field automatically by the link I give
people.
E.g. custommer number 14 will get a link from me like this one:
http://www.myname.com/form.php?number=14
Or something similar.

What I would like to know is: how to put that "number 14" included in
the link into the form. Or (even better) send it as a hidden field in
the form?

Is there maybe a cgi script or php script that does this job? Or a
piece of javascript maybe?

Any advice would be appreciated.

Thanks for reading!


Posted by kchayka on May 8, 2005, 9:01 am
Please log in for more thread options


Moozie wrote:
>
> http://www.myname.com/form.php?number=14
>
> What I would like to know is: how to put that "number 14" included in
> the link into the form. Or (even better) send it as a hidden field in
> the form?

Just about everything you ever wanted to know about php can be found at
php.net. For this particular topic, see:
<URL:http://us4.php.net/manual/en/language.variables.external.php>

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.

Posted by David Dorward on May 8, 2005, 3:06 pm
Please log in for more thread options


Moozie wrote:

> Now I would like to fill out 1 field automatically by the link I give
> people.
> E.g. custommer number 14 will get a link from me like this one:
> http://www.myname.com/form.php?number=14

> What I would like to know is: how to put that "number 14" included in
> the link into the form. Or (even better) send it as a hidden field in
> the form?

> Is there maybe a cgi script or php script that does this job?

Trival in any server side language.

Perl CGI for example:

use CGI;
my $cgi = CGI->new();
my $value = $cgi->param('number');
$value = 0 unless (defined $value); # Set a default
# Only allow numbers to protect against x-site scripting attacks
$value = 0 unless (int($value) eq $value);
print qq(<input type="hidden" name="number" value="$number">);

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is


Posted by Moozie on May 9, 2005, 6:23 pm
Please log in for more thread options


Thanks. I tested your code. I made a cgi file called form.cgi and put
your code in. I entered a link in browser to thast cgi script. And
tested with the addition: http://www.mydomain.com/form.cgi?number=14

I thought I would get a page with only the hidden code in it. Nut I
got an server-error.

Error message:
Bad header=<input type="hidden" name = "num....

The content of the whole cgi file:
> use CGI;
> my $cgi = CGI->new();
> my $value = $cgi->param('number');
> $value = 0 unless (defined $value); # Set a default
> # Only allow numbers to protect against x-site scripting attacks
> $value = 0 unless (int($value) eq $value);
> print qq(<input type="hidden" name="number" value="$number">);

Is there a mistake?

Thanks

I am rather new on cgi, so please forgive me some nembie mistakes...

Posted by Trammel on May 11, 2005, 7:13 am
Please log in for more thread options


[snip]
> I am rather new on cgi, so please forgive me some nembie mistakes...

Not helpful of me but I thought I should point out that its spelt
"newbie"...
...learn the basics like that and the code should just fall in place (With
help from someone who knows how to do what you want done ;¬)



Similar ThreadsPosted
Is creating a fill-out form a science? September 11, 2005, 10:01 am
Form problem September 24, 2008, 12:36 am
Strange form problem October 21, 2004, 9:09 pm
Strange form problem October 21, 2004, 10:20 pm
Contact Form Problem January 9, 2005, 10:29 pm
Form submit problem in IE March 31, 2006, 7:41 am
Form problem and Firefox April 6, 2006, 7:54 am
Problem with an upload form September 27, 2006, 11:50 pm
Form POST problem May 14, 2007, 2:49 am
Form POST problem May 15, 2007, 2:53 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap