display Range of date depend on user input php

Hi, i am very new to php Is it possible to display Range of date depend on user input day

example:

user input 2 day start from 28/4/12 it will add 2 day from date of input
 
so display should look like this
 
28/4/12 to 30/4/12
 
then from 30/412 user add another 4 date so will be
 
28/4/12 to 30/4/12
 
30/4/12 to 4/5/12
 

here is my plan
let user input day and date

but date only need the first time and needto store to Db inputd use below to add day from user input

$date_end = strtotime(date("Y-m-d", strtotime($dateinput)) . "+". $dayinput . "day"); 

after add it need to update Db for last update date and use function below to get start date

start_date  = strtotime(date("Y-m-d", strtotime($date_end)) . "-". $dayinput . "day"); 
 

so diplay should now look like that

$date_start= 28/4/12
 
$date_date = 30/4/12
 

but how can I do that if I want to use userinut date only at first time ?

Do I need while loop if I use need to make sure that dayinput no add together ?

How can I repeat process?

Thank you