Assuming that a string always starts or ends with the same sequence (in this example: j) and has a number that is incremented, then you could request a custom sequence, in which a separate sequence may distinguish different types of students in this case (For example: F for freshman, SM for sophomore, J for Junior, SR for Senior, and C for continuing student). As long as you have a separate variable representing an integer, you could increment that number and concatenate the strings to produce the final unique string:
HTML
<!-- Form -->
<form action="process.php" method="GET" \>
<!-- Select Department -->
<select name="department">
<option value="BSME">What Ever this stands for</option>
<option value="nextD">Next Department</option>
<option value="anotherD">Another Department</option>
</select>
<!-- Enter Year (Not sure how this is determine, assuming input) -->
<input type="text" name="year" />
<!-- Apply Custom Sequence -->
<input type="text" name="customSequence" />
<!-- SUBMITION - Call Processing -->
<button type="submit" value="Generate" />
</form>
**PHP - process.php **
// Initialize Values
$departmentFromSelect = $_GET['department'];
$yearFromForm = $_GET['year'];
$valueFromSequenceInput = $_GET['customSequence'];
// INTEGER TO INCREMENT WOULD HAVE TO BE STATIC OR GLOBAL
public static $integerToIncrement = 0;
// Call the function passing to generate next reg number
function generateRegistrationNumber() {
// Increment integer for next value
$integerToIncrement++;
// Concatenate String
$finalRegNum = $departmentFromSelect . "/" . $integerToIncrement . $valueFromSequenceInput . "/" . $year;
return $finalRegNum;
}