473,396 Members | 1,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

separating variables from one input

Information is entered randomly in just one text box (name, social security
number, lenght,weight).

The problem is how to recognize that what actually was the name, and what
was lenght etc.

So how can i separate the inputs in their own variables?

Jul 17 '05 #1
2 2267
Hello,

<mh> wrote:
Information is entered randomly in just one text box (name, social
security number, lenght,weight).

The problem is how to recognize that what actually was the name, and what
was lenght etc.

So how can i separate the inputs in their own variables?


This is only possible if you can define clear rules yourself
how a program could recognize which information is in a certain
piece of the string. But I think in this case you can.

Social Security Number
I guess this one typically has a fixed format with a
fixed number of digits, totally different from the
expected values of length and weight.

Length
Would typically be a number in a
lower range than weight.

Weight
Would typically be a number in a
higher range than length.

Name
Would be the other field. Probably shouldn't contain
any numbers and have a certain minimum length.

For the string in which the information is entered,
you have to decide on which characters you interpret
as delimiters. Then just split the string on that,
loop through the elements, check what each element
most looks like and put the value of the element
in the corresponding variable.

Best regards,

Eric
Jul 17 '05 #2
On Wed, 29 Oct 2003 11:11:03 +0100, Eric Veltman
<eric@[RemoveThis]veltman.nu> wrote:
Hello,

<mh> wrote:
Information is entered randomly in just one text box (name, social
security number, lenght,weight).

The problem is how to recognize that what actually was the name, and what
was lenght etc.

So how can i separate the inputs in their own variables?
Length
Would typically be a number in a
lower range than weight.

Weight
Would typically be a number in a
higher range than length.


Do the length and weight elements contain a unit? e.g. 15kg, 4in, etc?

That would make identifying them easier, but also opens the quesiton
of what units are allowable. Is the user restricted to, say, inches,
or can they also enter centimetres, furlongs, miles, etc. Are mixed
units allowable, e.g. 5ft9in, or even 7ft3cm ?

--
David ( @priz.co.uk )
The Internet Prisoner Database: http://www.priz.co.uk/ipdb/
The Tarbrax Chronicle: http://www.tarbraxchronicle.com/
Jul 17 '05 #3

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

Similar topics

0
by: David | last post by:
Can anyone give me some help or tips in converting this code to take 2 variables that will specify the number of Pack type lines and the number of Single type lines. We use it to create a web page...
3
by: Robert | last post by:
Hello, Can anyone help with this? On my online order form, I need to send a few variables to my credit-card processor. These variables are for non-secure customer comments, and will be sent...
12
by: Dave | last post by:
Hello, I'm a somewhat PHP newbie, so please bear with me. Here is what I am trying to do: $foobar = "blah blah"; $a = "foo"; $b = "bar"; $fooboo = "$a" . "$b"; echo $fooboo
8
by: Jeff S | last post by:
Please note that this question is NOT about any particular pattern - but about the general objective of separating out presentation logic from everything else. I'm trying to "get a grip" on some...
1
by: Paradox | last post by:
Hi everyone, kinda new to Javascript. Here is the issue, I have a form that sends to a different action based on the button pushed. But it also is sending variables to the server as well. Here...
14
by: Frank Swarbrick | last post by:
A few weeks ago I had posed a question about how one my create a cursor for a query where the predicate condition is dynamic. Meaning that the query might want to have one of several possible...
5
by: Sandman | last post by:
I dont think I understand them. I've read the section on scope in the manual inside out. I'm running PHP 5.2.0 Here is the code I'm working on: //include_me.php <?php $MYVAR = array(); global...
15
Ajm113
by: Ajm113 | last post by:
Ok, I want to know. What do they call it when you want to separate words from spaces or ',' in the php script so I may enter in multiable items for that script to look up? Like a search engine...
18
by: Bruce | last post by:
When I do this: <input id="someName" type="text"> <script type="text/javascript"> alert(someName.nodeName); </script> Both IE6 and Firefox alert("INPUT"). Why isn't "someName" undefined?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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,...
0
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...
0
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...
0
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,...

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.