views:

33

answers:

2

I have an array:

$k[23]='something'; 
$k[44]='something more'; 

If a user enters 2,3 and presses 'go' in a virtual 10 digit keypad (will look like a calculator), I need to pass 'something' to browse.php.

If the user press 4,4 and press go, then i have to pass 'something more' to browse.php.

Any ideas? I am new to javascript/php

A: 

Store as a string and reference as $k[$textEntered];

So $textEntered could equal 23 which will point to 'something';

Toby
plz explain a bit more, not got what u r meaning. I am a noob..
Kiran George
how to store the data getting from button flicks from an html form
Kiran George
+3  A: 

Or this:

<script>
var $k=[];
$k[23]="something"; 
$k[44]="something more";
function pass(theForm) {
  var val = parseInt(theForm.lcd.value);
  if ($k[val]) window.frames["f1"].location='http://google.com/search?q='+escape($k[val]);
  return false
} 
</script>
<form onsubmit="return pass(this)">
<input type="text" name="lcd" value="" />
<input type="button" value="2" onClick="this.form.lcd.value+=this.value" />
<input type="button" value="4" onClick="this.form.lcd.value+=this.value" />
<input type="submit" value="GO" >
</form>
<iframe name="f1" src="about:blank"></iframe>
mplungjan
thx mplungjan.. for what is that iframe ?
Kiran George
Since you did not explain how you were planning to call the PHP, I made a demo that sends the selection to google search in an iframe. If you just want to call the php, change window.frames["f1"].location='http://google.com/search?q=towindow.location='browse.php?k=without changing anything else
mplungjan