laurieballard Posted June 7, 2008 Share Posted June 7, 2008 Hi I have coded a contact form in HTML and created a PHP script to send the form to my email address. I uploaded both to the server and when i click on 'Send' it just takes me to the php script as if t is a link instead of running the actual script itself. The coding is below: This is the HTML code i used to create the form http://www.complain2.co.uk/test/text/contactus.txt This is the PHP script i used (minus the <?php and ?> tags) http://www.complain2.co.uk/test/text/contactform.txt The actual form on the server is here http://www.complain2.co.uk/test/contactus.html Any help would be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/109133-solved-problems-with-contact-form-in-php/ Share on other sites More sharing options...
.josh Posted June 7, 2008 Share Posted June 7, 2008 php script files need to have a .php file extension in order for the server to recognize it as a php file. Quote Link to comment https://forums.phpfreaks.com/topic/109133-solved-problems-with-contact-form-in-php/#findComment-559794 Share on other sites More sharing options...
laurieballard Posted June 7, 2008 Author Share Posted June 7, 2008 Yeah the actual file on the server has a php file extention. The link i posted is only a txt file just to how you the actual code. Quote Link to comment https://forums.phpfreaks.com/topic/109133-solved-problems-with-contact-form-in-php/#findComment-559798 Share on other sites More sharing options...
.josh Posted June 7, 2008 Share Posted June 7, 2008 yeah i realized that you may indeed have had it correct (I viewed source of your actual link and your action points to a .php) so... what type of hosting do you have? You may want to check your mime types in your cpanel make sure php is listed as an application and .php is listed as a mime type for it. Failing that, you probably want to contact your host and ask them wtf. Quote Link to comment https://forums.phpfreaks.com/topic/109133-solved-problems-with-contact-form-in-php/#findComment-559800 Share on other sites More sharing options...
laurieballard Posted June 7, 2008 Author Share Posted June 7, 2008 Thanks for the fast responses. The phpinfo is in the link below http://www.complain2.co.uk/test/phpinfo.php under default_mimetype it says 'text/html'.....would this be correct? I have a forum on the webserver which uses PHP and it works perfectly so i am guessing php is workinh correctly on the server. Does the actual php code look correct because i am completely new to php and this is my first script? Quote Link to comment https://forums.phpfreaks.com/topic/109133-solved-problems-with-contact-form-in-php/#findComment-559803 Share on other sites More sharing options...
.josh Posted June 7, 2008 Share Posted June 7, 2008 yeah..the actual code looks okay, except for echo "thanks.html"; that's just going to echo "thanks.html" not some actual file. Quote Link to comment https://forums.phpfreaks.com/topic/109133-solved-problems-with-contact-form-in-php/#findComment-559806 Share on other sites More sharing options...
laurieballard Posted June 7, 2008 Author Share Posted June 7, 2008 oh ok i was a bit unsure of that bit anyway...i thought it would take the user to the thanks.html page on the server......it doesnt echo anything when you click 'Send' so i am guessing its not even getting as far as that part in the code. To be honest i dont think it is running the php script at all....does the html code look ok? Quote Link to comment https://forums.phpfreaks.com/topic/109133-solved-problems-with-contact-form-in-php/#findComment-559807 Share on other sites More sharing options...
.josh Posted June 7, 2008 Share Posted June 7, 2008 ah, well, the link you posted to the text file version is missing a > on your closing form tag but when I view source of the real link it's all there and the form part of your html is okay. I enter in some random information into your form and it takes me to your .php file. And I think it's being processed because if it wasn't recognizing it, it would just spit out your code like a text file. But if the code you posted is exactly what you have, minus the php tags..it should work. So it's definitely something to do with the server. Quote Link to comment https://forums.phpfreaks.com/topic/109133-solved-problems-with-contact-form-in-php/#findComment-559810 Share on other sites More sharing options...
DarkWater Posted June 7, 2008 Share Posted June 7, 2008 There must be an error in the PHP that's not causing it to finish the script. Check the Apache logs for your PHP errors. Quote Link to comment https://forums.phpfreaks.com/topic/109133-solved-problems-with-contact-form-in-php/#findComment-559812 Share on other sites More sharing options...
laurieballard Posted June 7, 2008 Author Share Posted June 7, 2008 how would i go about checking the apache logs? I am really new to php scripting Quote Link to comment https://forums.phpfreaks.com/topic/109133-solved-problems-with-contact-form-in-php/#findComment-559814 Share on other sites More sharing options...
.josh Posted June 7, 2008 Share Posted June 7, 2008 in your cpanel or whatever you use to access your server stuff (same place you went to look for mime types earlier) there should be an error log link Quote Link to comment https://forums.phpfreaks.com/topic/109133-solved-problems-with-contact-form-in-php/#findComment-559817 Share on other sites More sharing options...
DarkWater Posted June 7, 2008 Share Posted June 7, 2008 My Apache logs are at /var/log/apache2. Not sure about you though. Quote Link to comment https://forums.phpfreaks.com/topic/109133-solved-problems-with-contact-form-in-php/#findComment-559818 Share on other sites More sharing options...
laurieballard Posted June 7, 2008 Author Share Posted June 7, 2008 I have checked the logs and nothing is in there reagrding php Quote Link to comment https://forums.phpfreaks.com/topic/109133-solved-problems-with-contact-form-in-php/#findComment-559828 Share on other sites More sharing options...
.josh Posted June 7, 2008 Share Posted June 7, 2008 hmmm I really don't know what else to say except to contact your host and ask them what's up then. Quote Link to comment https://forums.phpfreaks.com/topic/109133-solved-problems-with-contact-form-in-php/#findComment-559829 Share on other sites More sharing options...
laurieballard Posted June 7, 2008 Author Share Posted June 7, 2008 Just want to thank everyone for their help but i seem to have fixed it. There was a colon at the end of one of the lines instead of a semi colon......doh!!....how silly do i feel lol Quote Link to comment https://forums.phpfreaks.com/topic/109133-solved-problems-with-contact-form-in-php/#findComment-559843 Share on other sites More sharing options...
.josh Posted June 7, 2008 Share Posted June 7, 2008 haha damn no worries i missed that too and I must have looked at that script half a dozen times ; : ; : ; : Quote Link to comment https://forums.phpfreaks.com/topic/109133-solved-problems-with-contact-form-in-php/#findComment-559853 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.