The ping is now working, but the results are being outputted to the top of the screen.
I'm assuming now to get the results to appear underneath the form rather then at the top I need to turn something into a variable (as you mentioned) but I can't get this working.
I seriously wish I was better at PHP coding - I'm just not meant to be a programmer though!!! Took me long enough to get the ping script working.