Pass html variable to php

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 (sorry it’s german :frowning:)
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">

<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!" />


PHP code

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

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

1 Like
Sponsor our Newsletter | Privacy Policy | Terms of Service