输入字符串以下划线的形式分隔

I haven't come to much luck finding anything on this, since I couldn't think how to word it originally.

Basically I have a form, in HTML, the end user will submit a value such as "12345_54321" into 1 input field, then process.

I would like to be able to allow there to be 2 input fields instead, so one of them they would enter "12345" and in the second one, they'd enter "54321".

Which seems easy enough, but my real need is that the "_" must be used as a separator, such as, when the value is submitted, it will process "12345_54321" instead of "12345" and "54321"

My form so far:

<form role="form" method="post" action="process.php">
<fieldset>
<div class="form-group">
  <input size="18" type="visible" name="postid" id="postid" class="form-control" placeholder="Enter Story ID Here:" class="input-medium" ><input size="18" type="visible" name="postid" id="postid" class="form-control" placeholder="Enter Comment ID Here:" class="input-medium" >
</div>
    <input type="submit" name="submit" class="btn btn-primary btn-large" id="submit_btn" value="Process"/>
</fieldset>

If you want to display 2 inputs for the story id, you have to modify your page to be like so (no need for the underscore (_):

<form role="form" method="post" action="process.php">
  <fieldset>
    <div class="form-group">
      <input size="18" type="visible" name="story_id_1" id="story_id_1" class="form-control" placeholder="Enter Story ID Here:" class="input-medium" >
      <input size="18" type="visible" name="story_id_2" id="story_id_2" class="form-control" placeholder="Enter Story ID Here:" class="input-medium" >
      <input size="18" type="visible" name="comment_id" id="comment_1" class="form-control" placeholder="Enter Comment ID Here:" class="input-medium" >
    </div>
    <input type="submit" name="submit" class="btn btn-primary btn-large" id="submit_btn" value="Process"/>
  </fieldset>
</form>

In your process.php you can get these variables by looking in your POST.

<?php
$story_id_1 = '';
$story_id_2 = '';
$comment_id = '';

// Check for empty fields
if(isset($_POST['story_id_1']))
  $story_id_1 = $_POST['story_id_1']; // From HTML Page
if(isset($_POST['story_id_2']))
  $story_id_2 = $_POST['story_id_2']; // From HTML Page
if(isset($_POST['comment_id']))
  $comment_id = $_POST['comment_id']; // From HTML Page

print 'Story Id 1: '. $story_id_1 . '</br>';
print 'Story Id 2: '. $story_id_1 . '</br>';
print 'Comment Id: '. $comment_id . '</br>';

Add a hidden field, whose value will be the concatenation of the two input fields:

and on submit, set its value by concatenating the values of the two input fields:

<form role="form" method="post" action="process.php">
<fieldset>
    <input type="hidden" id="theValue" />
    <div class="form-group">
        <input size="18" type="visible" name="postid" id="postid1" class="form-control" placeholder="Enter Story ID Here:" class="input-medium" onchange="concat();">
        <input size="18" type="visible" name="postid" id="postid2" class="form-control" placeholder="Enter Comment ID Here:" class="input-medium" onchange="concat();">
    </div>
    <input type="submit" name="submit" class="btn btn-primary btn-large" id="submit_btn" value="Process" />
</fieldset>

<script>
// if no jQuery.....standard ECMAScript
function concat() {
    var val = document.getElementById('postid1').value + '_' + document.getElementById('postid2').value;
    document.getElementById('theValue').value = val;
    console.log(val);
}