# How to include a PHP form in HUGO

**URL:** https://discourse.gohugo.io/t/how-to-include-a-php-form-in-hugo/32942
**Category:** tips & tricks
**Created:** [May 17, 2021, 8:10pm UTC](https://discourse.gohugo.io/t/how-to-include-a-php-form-in-hugo/32942 "2021-05-17T20:10:40Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![frjo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/frjo/32/18626_2.png) [@frjo](https://discourse.gohugo.io/u/frjo)
#### Post date: [May 19, 2021, 12:21pm UTC](https://discourse.gohugo.io/t/how-to-include-a-php-form-in-hugo/32942/2 "2021-05-19T12:21:17Z")

</div>

Nice write up!

Some tips:

If you simply want to include a PHP file you can put in in “static” and it will be copied over as is.

Instead of creating a “baseof.php.php” you can skip declaring {{ define “main” }}…{{ end }} in “single.php.php”.

Instead of using “readFile” you can put the PHP code directly in “single.php.php” by using “safeHTML” like this “{{ “\<?php” | safeHTML }}” whenever your code has “\<” or “\>”.

This way you can insert template variables in the code, really useful sometimes.

---

_[View the full topic](https://discourse.gohugo.io/t/how-to-include-a-php-form-in-hugo/32942)._
