That's my full code for a PHP page. You enter details on the page and it is supposted to email you what was typed in the password and username box, but it doesnt. The rest of the form works fine.
It's probobly something simple but I can't get it.
You're concatenating your headers variable (i.e. $headers .=) when it wasn't previously defined and in the mail() function you use the variable $header instead of $headers.....
I've switched careers...
I'm NO LONGER a scientist,
but now a web developer...
awesome.
Just to make sure, you are submitting this form to the same page, right? So you're action field should be blank (although you can fill it in with the url of the same page you are using)
Nevermind, you're missing the single quotes in your isset statement, it should be
PHP Code:
if (isset($_POST['username'])) {
You have $_POST[username]
I've switched careers...
I'm NO LONGER a scientist,
but now a web developer...
awesome.
You can do either with the action field (have it pointed to the current url or leave it blank) but I think the blank is better from a security point of view. Post the code that you're using now so I can see if there are any other errors. Also, is it giving you an error when you execute the code? Try to debug it by adding an echo statement after your if statement just to see if the if(isset($_POST['username'])) is being executed
I've switched careers...
I'm NO LONGER a scientist,
but now a web developer...
awesome.
You're still concatenating the headers (i.e. $header .=)
$headers was not previously defined so it should be an = not a .=
Also, it doesn't make sense to split it into two strings so replace your headers line with this one.
PHP Code:
$headers = "From: person@email.com\r\n";
I've switched careers...
I'm NO LONGER a scientist,
but now a web developer...
awesome.
Bookmarks