i need a combinations for the required and optional fields

For Eg: required field [1,2,3]
        optional field [1,2,3,4,5]
   I have a textbox for selecting the titles. when i enter the textbox value as 4 for the combinations i should get result as [1,2,3,4] and [1,2,3,5] .. the [1,2,3] from the required field .. 


 Thankyou in advance

What have you done so far?

i have finished with this only

<?php

include "Combinatorics.php";

$mycalc=new Combinatorics;

// Combinations without repetition
$combwr=$mycalc->makeCombination(array("A","B","C","d","E"), 4);
echo"and they are the followings:</BR>";
foreach($combwr as $key=>$value){
echo $key .": ";
foreach ($value as $key2=>$value2){
echo $value2;
}
echo "</BR>";
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.