Portal Home > Knowledgebase > Articles Database > Problems with PHP form submission
Problems with PHP form submission
Posted by jofield, 11-12-2011, 09:03 AM |
Hi
I have a form I have set up using php that should submit an email on completion. When I set it up and tested it on my own website it worked absolutely fine but now I have uploaded it to a different website it no longer sends the email even though I get no error messages. i have spoken to the hosting company who have advised Emails have to have a senders address specified in your code, the server will reject any other emails to prevent spam. But surely that's what this line of my code does:
doesn't it?
Can anyone help me please?
Full code supplied below
Thanks
Jo
Last edited by bear; 11-12-2011 at 11:30 AM.
Reason: fixed code tags
|
Posted by web-project, 11-12-2011, 11:22 AM |
normally it should be:
I think the issue in captcha
|
Posted by jofield, 11-12-2011, 12:06 PM |
I've changed it as you suggested to
include('/forms/securimage/securimage.php');
But its still not working, do you think it could be anything else?
|
Posted by breton, 11-13-2011, 04:25 AM |
include('/forms/securimage/securimage.php');
There is no such path. You need to make the include path relative
include('forms/securimage/securimage.php');
or absolute
include('/home/user/www/forms/securimage/securimage.php');
|
Posted by jofield, 11-13-2011, 04:56 AM |
Hi Breton
Sorry for being such a newbie at this but i've tried include('forms/securimage/securimage.php'); and it still doesn't work and I'm unsure on the other option you gave include('/home/user/www/forms/securimage/securimage.php'); am I right in saying this would be the full path i.e. from the FTP root directory?
I guess the biggest thing I don't get is why it works okay as it was on my webserver but not on the new webserver!
Last edited by jofield; 11-13-2011 at 05:04 AM.
|
Posted by jofield, 11-13-2011, 05:42 AM |
okay so I've managed to work out my absolute path (/var/www/vhosts/rework.co.uk/httpdocs/forms) and have inserted it but it still isn't working
|
Posted by breton, 11-13-2011, 06:08 AM |
i've tried include('forms/securimage/securimage.php'); and it still doesn't work
When you enter your ftp, what is the path from the entry point to securimage.php? What is the path from the entry point to the file you are editing?
> I guess the biggest thing I don't get is why it works okay as it was on my webserver but not on the new webserver!
The biggest thing I don't get is why it worked before.
|
Posted by jofield, 11-13-2011, 06:15 AM |
httpdocs/forms/securimage/securimage.php is the path from ftp. I just uploaded a find path test that told me the absolute path is /var/www/vhosts/rework.co.uk/httpdocs/forms/securimage/securimage.php but that doesn't work either.
Originally when it was working on my server I had it set as include('http://www.fieldshypnotherapy.co.uk/rework/forms/securimage/securimage.php'); and this was working fine.
|
Posted by breton, 11-13-2011, 06:23 AM |
Does it give you any errors? Do you have access to error.log?
|
Posted by jofield, 11-13-2011, 07:13 AM |
The error I get just says I've entered the CAPTCHA code incorrectly. I've just checked for error logs and it would seem that I have but there's nothing in there since August this year
|
Posted by jofield, 11-14-2011, 03:44 AM |
okay so with a little playing around I've managed to sort all my paths for the CAPTCHA and this is no longer causing an issue.
I now get confirmation that my form has submitted successfully and that works fine. However, I still don't get the actual email confirmation. I get this fine when tested on my own webserver just not on the clients. The client's hosting company say this is because the sender's email address needs to be specified by surely that's what this line of my code does:
$mailheader = "From: ".$_POST["email"]."\r\n";
Does anyone have any other suggestions??
Many thanks for any assistance
|
Posted by MrKenTX, 11-17-2011, 01:39 AM |
Not sure what is not working for you, but if it works on one machine and not another I would first suggest verifying the config settings for php and apache were the same on both machines.
However, as somebody who has deployed many web form to email projects I suggest you look into PHPMailer and use SMTP. Just google it.
|
Add to Favourites Print this Article
Also Read