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 <input>...</input> 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 to GET/POST?


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 ?>" />

You can use the button element:

<button type="submit" name="seven" value="7">Push Me</button>


You Can use the hidden field to store or post the $fields+1 value:

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

Need Your Help

Comparator return type is not compatible with integer

java sorting debugging comparator

I am trying to sort an object via the object attribute NodeID which is long type.

How to rename a seam project

jboss project seam rename

I created a seam project using seam-gen utility tool. I want to change the name of the project. How can I update it ?