That is an excellent question and one that is best answered by your primary care doctor
as he or she can evaluate your medical history and examination and determine the right course of treatment for you. In general, having sustained an injury like that one you describe could be something simple such as a sprain or strain of the muscles in that area, or something more serious such as a fracture
of one of the bones in the foot or toe. Depending on what they find, they may want to obtain an x-ray
to see exactly what is happening with the bones in your foot. Usually this is treated with a splint of the toe, and surgery is rarely warranted in these circumstances. Other suggestions that your doctor will likely also make include icing your foot, elevating it high to decrease the swelling, taking anti-inflammatory medications, and compressing your toe to also decrease the swelling. Usually the pain will slowly resolve after an injury such as this with time, but it is still important to be evaluated by a medical professional so that you know there is nothing serious going on and that someone is following you for this.