iwan_groznyj iwan_groznyj - 1 year ago 59
HTML Question

Submit buttons: button text different from value

I am writing a search form in PHP.
I want the user to be able to add search fields using following submit button:

<input type="submit" name="fields" value="<?php echo $fields+1 ?>" />

Now the button shows the value of
$fields + 1
Actually what I want is the button to show something else (like add new field).
Just adding text between the
tags does not help.
The text just appears right of the button.

How do I change the text on the button and still pass the value of
$fields + 1

Answer Source

You can use an hidden input to store the value count, it will be available after GET/POST:

<input type="submit" name="fields" value="add new field" />
<input type="hidden" name="fieldsCount" value="<?php echo $fields+1 ?>" />
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download