I have to pass an id together with an application area e.g

<input name="__field_name" value="1234" />

this only passes the title and cost like a key => value pair. i have to keep your title (dynamically joined through the user) and cost intact later, however i should also pass an ID together with this var.

how do i do that cleanly? i believed putting it within the title and carrying out a regex to seperate it e.g.

__field_name__ID  

even though this appears untidy...

facts to consider:

  • you will find allot of publish variables which are produced through the Content management systems (wordpress) which i wont use
  • title should be maintained in original format together with value

You could include a concealed area which consists of the input area title value.

<input type="text" name="field_1" />
<input type="hidden" name="field_1_name"/>

You have to give a hidden form area which consists of the Id from the first area. You are able to title it as being field1_ID or something like that.

<input type="text" name="first_field" value="As_Entered_By_User"/>
<input type="hidden" name="first_field_id" value="id_first_field"/>

Or if you're acquainted with Javascript, You are able to publish it using javascript with single form area putting the id being an attribute.

<input type="text" name="first_field" id="first_field_id" value="as_enteredBy_user"/>
<script>var id_to_post=document.form1.first_field.id;</script>

here form1 may be the title from the form that contains the input box.

Why don't you submit the information being an array?

Rather than calling your area __field_name__id or some mess, make use of the facilities PHP provides: Call your input area field_name[id] so when the shape is published to the server, PHP's $_POST array may have a sub-array known as field_name which consists of the important thingEquals>value mappings you'd pointed out.

For those who have two such fields you need to tie together, make use of the following:

<input type="text" name="myFields[id]" />
<input type="text" name="myFields[name]" />

As well as on postback, PHP provides you with a $_POST['myFields']['id'] and $_POST['myFields']['name'].