Page 1 of 1

Newb Here, I need some help (input/output)

Posted: Fri Aug 01, 2003 2:02 pm
by bow-viper1
Alright, first post here. Great forums btw. If i'm posting this in the wrong place im sorry. I'm sort of just getting into html and I had a question on how to do something. Ok here it is.

I Want two text boxes, one above, one below. And a command button. When the button is pushed I want the Letters in the top textbox (Its Alpha only) to be kind of coded in the bottom textbox, I want it one to the right of each letter you push on the keyboard. Please not this is letters only, for example. A = S, S = D, P = [, And so on, and I understand there is no "Next letter to the right" command heh, It will probably have to be done letter by letter, thank god there is only 26

So just give me an example with 2 or 3 letters and I'll do the rest, I hope this wasn't too confusing.



I found a better way of putting it if you dont understand what I'm asking.

If I put this in the top textbox: "asdf"
Push button
I want it to say this in the bottom textbox: "sdfg"

Posted: Fri Aug 01, 2003 2:55 pm
by McGruff
Take a look at the php string functions (see php.net for manual - can get a downloadable version if you don't have one already).

As an example, you could use str_replace() with a search array containing values for each letter in the alphabet, and a replace array the same but starting at B.

There are other ways to do it: using an alphabet string, string positions and integer arguments could create a less "hard-coded" solution so that you could vary your encryption substitutions easily.

Posted: Sat Aug 02, 2003 10:51 pm
by jmarcv

Code: Select all

$kbd=' asdf';
$char='d';
$newchar=substr($kbd,strpos($kbd,$char)-1,1);
echo $newchar;
output should be 's'