Can i link to a php file?

Dear all

i have a php file named mailhandler and html file contact form so
how can to link php file with html file

here is code

<?php
	$owner_email = $_POST["owner_email"];
	$headers = 'From:' . $_POST["email"];
	$subject = 'A message from your site visitor ' . $_POST["name"];
	$messageBody = "";
	
	if($_POST['name']!='nope'){
		$messageBody .= '<p>Visitor: ' . $_POST["name"] . '</p>' . "\n";
		$messageBody .= '<br>' . "\n";
	}
	if($_POST['email']!='nope'){
		$messageBody .= '<p>Email Address: ' . $_POST['email'] . '</p>' . "\n";
		$messageBody .= '<br>' . "\n";
	}else{
		$headers = '';
	}
	if($_POST['state']!='nope'){		
		$messageBody .= '<p>State: ' . $_POST['state'] . '</p>' . "\n";
		$messageBody .= '<br>' . "\n";
	}
	if($_POST['phone']!='nope'){		
		$messageBody .= '<p>Phone Number: ' . $_POST['phone'] . '</p>' . "\n";
		$messageBody .= '<br>' . "\n";
	}	
	if($_POST['fax']!='nope'){		
		$messageBody .= '<p>Fax Number: ' . $_POST['fax'] . '</p>' . "\n";
		$messageBody .= '<br>' . "\n";
	}
	if($_POST['message']!='nope'){
		$messageBody .= '<p>Message: ' . $_POST['message'] . '</p>' . "\n";
	}
	
	if($_POST["stripHTML"] == 'true'){
		$messageBody = strip_tags($messageBody);
	}
	
	try{
		if(!mail($owner_email, $subject, $messageBody, $headers)){
			throw new Exception('mail failed');
		}else{
			echo 'mail sent';
		}
	}catch(Exception $e){
		echo $e->getMessage() ."\n";
	}
?>

and this is the html file

<form id="contact-form">
          <div class="success"> Contact form submitted! We will be in touch soon. </div>
          <fieldset>
            <div>
              <label class="name">
                <input type="text" value="Name:">
                <br>
                <span class="error">*This is not a valid name.</span> <span class="empty">*This field is required.</span> </label>
            </div>
            <div>
              <label class="email">
                <input type="email" value="E-mail:">
                <br>
                <span class="error">*This is not a valid email address.</span> <span class="empty">*This field is required.</span> </label>
            </div>
            <div>
              <label class="phone">
                <input type="tel" value="Phone:">
                <br>
                <span class="error">*This is not a valid phone number.</span> <span class="empty">*This field is required.</span> </label>
            </div>
            <div>
              <label class="message">
                <textarea>Message:</textarea>
                <br>
                <span class="error">*The message is too short.</span> <span class="empty">*This field is required.</span> </label>
            </div>
            <div class="buttons-wrapper"><a class="button" data-type="reset">Clear</a><a class="button"  data-type="submit">Send</a></div>
          </fieldset>
        </form>


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900

For this you need to follow the following steps:.
Step 1: Filter your HTML form requirements for your contact us web page. ... .
Step 2: Create a database and a table in MySQL. ... .
Step 3: Create HTML form for connecting to database. ... .
Step 4: Create a PHP page to save data from HTML form to your MySQL database. ... .
Step 5: All done!.
The include (or require ) statement takes all the text/code/markup that exists in the specified file and copies it into the file that uses the include statement. Including files is very useful when you want to include the same PHP, HTML, or text on multiple pages of a website.

How do I access a PHP file?

php" file extension. Open up any Web browser on your desktop and enter "localhost" into the address box. The browser will open a list of files stored under the "HTDocs" folder on your computer. Click on the link to a PHP file and open it to run a script.

How do I access a PHP file from a website?

If you installed a web server in your computer, usually the root of its web folder can be accessed by typing http://localhost in the web browser. So, if you placed a file called hello. php inside its web folder, you can run that file by calling http://localhost/hello.php.