I have this table:

I am trying show a hierarchical combo something like this:

It is posible to do this using a select statement or how I can implement this via PHP? I was googling and I found that it is posible using recursive functions but it is new for me and I can not implement this. May be somebody give me an idea?
Update:- I finally solved my problem. I create a recursive function based on @user2433317 code, first I create and initialized a variable to control the amount of blank spaces that I need in each level
$n=-3;
next I write the recursive function
function ShowSubCats($id){
global $cn, $n;
$sql = "SELECT * FROM menus WHERE idPadre = '$id';";
$r = mysqli_query($cn, $sql);
if (mysqli_num_rows($r) > 0) {
$n+=3;
while ($row = mysqli_fetch_object($r)) {
echo "<option value='$row->id'>".space($n).$row->titulo."</option>" ;
ShowSubCats($row->id);
}
$n-=3;
}
}
and call it with 0 argument that mean idPadre=0 don't have parent. Finally this is the space function
function space($n){
$str = "";
for ($i=0; $i<$n; $i++) {
$str .= " ";
}
return $str;
}
and the result is showed here

thank you for your answers and sorry for my english is not very good