Forum Moderators: coopster

Message Too Old, No Replies

simple generator script

easily customizable

         

Rischen

10:08 pm on Aug 27, 2005 (gmt 0)

10+ Year Member



Hi,

I'm looking for a simple open-ended form script that allows you to customize the generated feedback however you want. Something simple where if someone types 'x' in the field they get '123' where '123' is the feedback I specify in the script for the input variable 'x' and if they type 'y' they get '456' and if they type 'xy' they get '123456'. Sort of like the scripts you see on blogs that generate the meaning of your name from the letters in it. Just some kind of simple, generic non-specialized script that allows you to set whatever feedback you want for any particular form input.

I'd appreciate any pointers.

Best,

Rischen

ergophobe

6:29 pm on Aug 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



How many options are you talking about? If it's not many and you want real simple, you could just put all the options in an array where the array key is the input and the value is the output.

$arr = array(
'x' => '123',
'y' => '456');

then your output is

$output = $arr['x'] . $arr['y'];

That won't scale well and could get hard to maintain if you're thinking of something ambitious, but that's probably about the simplest approach I can think of.