473,651 Members | 2,750 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to do this? Form fill problem

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!
Jul 24 '05 #1
8 4853
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.variab les.external.ph p>

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.
Jul 24 '05 #2
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
Jul 24 '05 #3
"Moozie" <no****@dse.n l> wrote in message
news:e8******** *************** ***@posting.goo gle.com...
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!


Your form already uses PHP so all you need is to do is edit your PHP and add
a tiny "Value" to your inputbox within the form.

For example, here's a line I use in a login section to remember usernames
(single line follows):
echo ("Username: <input class=\"inputbo x\" type=\"text\" name=\"wUser\"
maxlength=\"40\ " value=\"$wUser\ "><br>");

To do the same with your number... maybe you'd want (single line follows):
echo ("Customer number: <input class=\"inputbo x\" type=\"text\"
name=\"number\" maxlength=\"5\" value=\"$number \"><br>");

Then your link http://www.myname.com/form.php?number=14 would automatically
fill-in the box "number" with 14... and the user could also change it.

If you dont want the value to be changed easily though... you could always
make the input box hidden ;)
Jul 24 '05 #4
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...
Jul 24 '05 #5
> Your form already uses PHP so all you need is to do is edit your PHP and add
a tiny "Value" to your inputbox within the form.


I am sorry for the mistake (I made it!) but the form handling is done
by a cgi script, that is already modified in a extended way. So I need
what you said (PHP) in a cgi version...

The cgi program I use is a modified version

Thanks. Any clues?
Jul 24 '05 #6
THANKS TOU YOU I SOLVED IT.

CLOSED
Jul 24 '05 #7
"Moozie" <no****@dse.n l> wrote in message
news:e8******** *************** ***@posting.goo gle.com...
[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 ;¬)
Jul 24 '05 #8
"Moozie" <no****@dse.n l> wrote in message
news:e8******** *************** ***@posting.goo gle.com...
THANKS TOU YOU I SOLVED IT.

CLOSED


See... all you needed was to be told how to spell "newbie" :¬P
Jul 24 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1407
by: Clevo | last post by:
Hello, I add a javascript check to each input field. I use an onBlur event. But I want to add a "batch check" function to a onSubmit event too. In case of onBlur the call my check like this: onBlur="isValidInt(this,'Error text',false) But how can I call in case of onSubmit. There I can't use the "this" and the following code doesn't work: isValidInt(document.ageField,'Error text', false);
3
3722
by: Leo | last post by:
Hi everybody, Is there a way to fill a continuous form with an ADO recordset? Normally when I populate the form with the recordset only the first record is shown. I want to fill all records. Thanks for your help. Leo
1
1121
by: juli jul | last post by:
Hello, I want to put on the form 2 panels. The first one contains tree view and the secound grid. I put a separator between both of the panels and tried to do dock=fill to both of them.The problem is that one panel is always above the other when I am doing it. How can seperate both of the panels with the stuff they consist and to dock both of them to the fill?
2
3672
by: Itar | last post by:
I'm having a problem when opening an MDI Child form. I'm declaring the child form then setting the dock property to fill so that it takes up the entire space of the MDI Parent window without being maximized (user request). The problem is that when the child form is being displayed it is briefly shown in it's default size before being resized to fill the available area on the MDI Parent form. How can I stop the MDI Parent from displaying...
0
1976
by: A_PK | last post by:
Hi I got the following environment.......Form1 and inside Form1, got Panel1.... I also got another new Form ...named Form2... Form1, Panel1 Form2 Inside Form1, I click a button to show Form2 using the following method... Private Sub ShowForm(ByVal form)
1
9515
by: Kent | last post by:
Hi, I have a form which contain 2 panels, Master and Detail, Master panel is on top and Detail panel is at the bottom. In the form, I set Detail panel to Dock to the bottom and Master panel Dock to fill. As a result, when I do form resize, Detail's height always retain whereas Master height change base on form size. What I want to do now is I want to set a minimum size for the form, so that if the form got resize small than certain...
6
2602
by: kaosyeti | last post by:
hey.... i have a duplicate record issue i could use some help with. on a form that has 2 unbound controls, txtboxyear and cboxmonth, together will automatically fill in an invisible txtboxdate that is bound to a table and has no duplicates allowed. the problem is that there are 30 or so other controls here to be filled in and if the user selects a year and month that already has a record created, she/he won't know it until access tries to...
9
3824
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web site for a small club I belong to and one of the features I would like to include is the ability to allow users to upload image files. unfortunately the servers web root www folder only allows READ and EXECUTE permissions, which makes it...
2
2280
by: (PeteCresswell) | last post by:
I've got a form that has a TreeView in the upper part of the form and a TabControl in the lower. When processing a Resize event, the TabControl does not need tb resized - just moved so that the TreeView can be expanded/contracted to fill the available space. But there seems tb some sort of chicken-and-egg problem with objects within the TabControl. Their coordinates are expressed relative to the form instead of the TabControl and...
0
8352
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8802
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8697
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8465
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8579
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7297
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6158
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5612
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
1587
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.