Posted by Toby Inkster on 11/28/06 16:25
blackjack wrote:
> I'd like to use 2 text fields, and a button that when clicked , would add
> the 2 fields together and display as a line of text, can anyone help with
> this.
<form method="get" action="<?= $_SERVER['PHP_SELF'] ?>"
onsubmit="this.c.value=Number(this.a.value)+Number(this.b.value);
return false;">
<fieldset>
<legend>Add things</legend>
<input name="a" value="<?= (real)$_GET['a'] ?>"> +
<input name="b" value="<?= (real)$_GET['b'] ?>">
<input type="submit" value="=">
<input name="c" value="<?= (real)$_GET['a'] + (real)$_GET['b'] ?>">
</fieldset>
</form>
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Navigation:
[Reply to this message]
|