# Pass html variable to php

**URL:** <https://www.phphelp.com/t/pass-html-variable-to-php/34357>\
**Category:** Beginners - Learning PHP\
**Created:** [December 9, 2021, 5:34pm UTC](https://www.phphelp.com/t/pass-html-variable-to-php/34357 "2021-12-09T17:34:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mawela](https://www.phphelp.com/letter_avatar_proxy/v4/letter/m/87869e/32.png) [@Mawela](https://www.phphelp.com/u/Mawela)\
**Post date:** [December 9, 2021, 5:34pm UTC](https://www.phphelp.com/t/pass-html-variable-to-php/34357/1 "2021-12-09T17:34:32Z")

</div>

I am trying to build a website and I need to pass variables from html to php. I tried different tutorials but they all don’t work. The last one I was using is from [PHP: Variablen aus externen Quellen - Manual](https://www.php.net/manual/de/language.variables.external.php) (sorry it’s german ☹)  
When I copy the code it still is not working and I do not know why. I just get a blank page as soon I press the submit button.  
I am an bsolute beginner and I do not understand prepared forms which are a little bit more complicates so I really need something easy to understand the process.  
HTML code:

```
<meta charset="UTF-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Document</title>

```

```
<form action="welcome.php" method="post">

    Name: <input type="text" name="username" /><br />

    E-Mail: <input type="text" name="email" /><br />

    <input type="submit" name="submit" value="Und ab!" />

</form>

```

PHP code

\<?php echo $\_POST['username']; echo $\_REQUEST['username']; ?\>

---

<div class="post-metadata">

**Author:** ![benanamen](https://www.phphelp.com/user_avatar/www.phphelp.com/benanamen/32/287_2.png) [@benanamen](https://www.phphelp.com/u/benanamen)\
**Post date:** [December 9, 2021, 5:42pm UTC](https://www.phphelp.com/t/pass-html-variable-to-php/34357/2 "2021-12-09T17:42:23Z")

</div>

Is your Php code in a file called welcome.php in the same folder as the form and running on a server with Php installed and called from a url starting with http?

Try the example #3 on the manual page. That one is set up to work as a single page and submit to itself
