It's actually all illegal. Even recording onto VHS is technically illegal, it's just ignored and excused.
iPlayer content is protected with DRM, so it makes it hard to do what you want with it.
However, if you search for your programme on somewhere like btjunkie, you may be able to find and download it, which will be in a more open format, so it's easy to write to a DVD.
Depending on your DVD player, you may need to use a tool like Super video encoder to turn the file into a DVD format, and then burn it to DVD.