I receive the following error when l click send on my website contact form. Parse error : syntax error, unexpected ‘$txt’ (T_VARIABLE) in /home4/djboziah/public_html/form-to-email.php on line 8 here is the code is my html code `
yes that got rid of my error,Thank you…but i know receive this warning when i click send on my contact form Warning : Cannot modify header information - headers already sent by (output started at /home4/djboziah/public_html/form-to-email.php:1) in /home4/djboziah/public_html/form-to-email.php on line 11
While it has got rid of the message, it has also prevented your header redirect from working. To get that working, you need to find and cure the cause of the problem, which is that your code has sent some output to the browser before it gets to the header line. It might be just as simple as blank space in the code file before your opening PHP tag. Your code in the first post appears to have a space on the first line:
<?php
before your < character, but that might just be on the forum. Little things like that can cause it.
You need to give us more information, in what way is it not working? Does it give an error message, display the wrong thing, display nothing? Or do you just not see the display because immediately before it you’ve done a header redirect? Exactly what happens?
Does your email get sent? Keep in mind that a lot of email servers will only send emails “from” domains that they are configured to send, because allowing any from-address is a security issue. You should send the message from your address, and use the “reply-to” header to govern where replies are sent.
unless they’ve just gone wrong when you posted in the forum. In any case, please mark code sections by using three backtick characters on a separate line before and after your code, makes it easier to read.
I am sorry for not giving details, form works, the email gets sent and received just fine. What is not working is the message i want the sender/subcriber to receive like you message has been sent.
Does your page redirect now work? If it does, your echo to show the message is after the redirect, so you won’t see it. The message needs to be on the page you redirect to.
You should look at using PHPMailer instead of the built-in PHP mail() function as it’s more reliable, once you have this working.