I have a PHP array:
foreach($xpath->query('//a') as $element) {
$linklabel[] = $element->textContent;
$link[] = $element->getAttribute("href");
$i=$i+1;
}
I also have an HTML form:
<form name="keypad" id="form" onSubmit="return pass(this)">
<input type="text" size="100%" length="25" value="" name="lcd">
<input type="button" value=" 1 " name="one" onClick="this.form.lcd.value+=this.value">
<input type="button" value=" 2 " name="two" onClick="this.form.lcd.value+=this.value">
<input type="button" value=" 0 " name="zero" onClick="this.form.lcd.value+=this.value">
<input type="submit" name="Submit" id="Submit" value="Go" >
</form>
How can I write the onSubmit function pass()
that takes the values from the keypad and sends the corresponding $link[]
value to browse.php. For example, if $link[20]='google.com';
, I want to pass $link[20]
to browse.php if user enters 20
in the keypad and presses Go