How to add an external php page with wordpress?

Firstly your question shows no research or effort whatsoever. Also it isn’t elaborated efficiently.

From what I gather you want a page with some code in wordpress. There are multiple ways to do it.

Easiest way would be to create a new page template in your theme file. Go to your active theme folder and create a new page template

<?php
/* Template Name: Form Page Template */

    if($_POST['xyz') {
    //Post form processing and data insertion here
    }
    ?>
    <form name="abc" method="POST" action="">
    <input type="text" name="xyz" />
    <input type="submit">
    </form>

    <!---You can add any html or PHP code to Page template ---->

After saving the template file. Go to pages->add new page in dashboard and create a new page . From page attributes drop down choose the page template you just created.