开发者

How to pass array variables based on condition to PHP using post method

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 pas开发者_开发百科s '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.


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>


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

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜