Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
Internal Server Error - Contact Forms???
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="svviift" data-source="post: 378095" data-attributes="member: 64697"><p>Hello DevBest,</p><p></p><p>I've been editing sites and contact forms for a long time now, but it wasn't until recently where I've gained a client and was asked to put in a form, and have had major problems from day one. We're due course to launch now and I'm not quite sure what I'm doing wrong.</p><p></p><p>The layout I was working from (they wanted me to use a template online because they liked it and wanted to speed up design and development) didn't have a contact form built into it per se, but did have the elements of it.</p><p></p><p>Anyway, I googled a simple form and pasted the code, as follows:</p><p></p><p style="margin-left: 20px"><em><form action="mail.php" method="POST"></em></p> <p style="margin-left: 20px"><em>Name <input type="text" name="name"></em></p> <p style="margin-left: 20px"><em>E-Mail<input type="text" name="email"></em></p> <p style="margin-left: 20px"><em>Message<textarea name="message" rows="6" cols="25"></textarea><br /></em></p> <p style="margin-left: 20px"><em><input type="submit" value="Send"><input type="reset" value="Clear"></em></p> <p style="margin-left: 20px"><em></form></em></p> <p style="margin-left: 20px"><em></em></p> <p style="margin-left: 20px"><em><?php</em></p> <p style="margin-left: 20px"><em>$field_name = $_POST['cf_name'];</em></p> <p style="margin-left: 20px"><em>$field_email = $_POST['cf_email'];</em></p> <p style="margin-left: 20px"><em>$field_message = $_POST['cf_message'];</em></p> <p style="margin-left: 20px"><em>$mail_to = ‘email@address.com';</em></p> <p style="margin-left: 20px"><em>$subject = 'Message from a site visitor '.$field_name;</em></p> <p style="margin-left: 20px"><em>$body_message = 'From: '.$field_name."\n";</em></p> <p style="margin-left: 20px"><em>$body_message .= 'E-mail: '.$field_email."\n";</em></p> <p style="margin-left: 20px"><em>$body_message .= 'Message: '.$field_message;</em></p> <p style="margin-left: 20px"><em>$headers = 'From: '.$field_email."\r\n";</em></p> <p style="margin-left: 20px"><em>$headers .= 'Reply-To: '.$field_email."\r\n";</em></p> <p style="margin-left: 20px"><em>$mail_status = mail($mail_to, $subject, $body_message, $headers);</em></p> <p style="margin-left: 20px"><em>if ($mail_status) { ?></em></p> <p style="margin-left: 20px"><em><script language="javascript" type="text/javascript"></em></p> <p style="margin-left: 20px"><em>alert('Thank you for the message. We will contact you shortly.');</em></p> <p style="margin-left: 20px"><em>window.location = 'index.html';</em></p> <p style="margin-left: 20px"><em></script></em></p> <p style="margin-left: 20px"><em><?php</em></p> <p style="margin-left: 20px"><em>}</em></p> <p style="margin-left: 20px"><em>else { ?></em></p> <p style="margin-left: 20px"><em><script language="javascript" type="text/javascript"></em></p> <p style="margin-left: 20px"><em>alert('Message failed. Please, send an email to <a href="mailto:email@address.com">email@address.com</a>');</em></p> <p style="margin-left: 20px"><em>window.location = 'index.html';</em></p> <p style="margin-left: 20px"><em></script></em></p> <p style="margin-left: 20px"><em><?php</em></p> <p style="margin-left: 20px"><em>}</em></p><p></p><p>I'm useless at php, so all of the PHP bit goes over my head, I've obviously created a mail.php form with the php code and put it in it, as have I got an index.html but I constantly get:</p><p></p><p style="margin-left: 20px"><span style="font-size: 22px"><strong>Internal Server Error</strong></span></p> <p style="margin-left: 20px">The server encountered an internal error or misconfiguration and was unable to complete your request.</p> <p style="margin-left: 20px"></p> <p style="margin-left: 20px">Please contact the server administrator at webmaster@[mysite].co.uk to inform them of the time this error occurred, and the actions you performed just before this error.</p> <p style="margin-left: 20px"></p> <p style="margin-left: 20px">More information about this error may be available in the server error log.</p> <p style="margin-left: 20px"></p> <p style="margin-left: 20px">Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.</p> <p style="margin-left: 20px"></p> <p style="margin-left: 20px"></p><p>Where do I go from here? What should I be looking at? I'm days off launching this and have only just come across the problem, the clients pushy to get live (as they always are) and I don't fancy delaying this much further as I had to push back because of uni stuff.</p><p></p><p>Any suggestions?</p></blockquote><p></p>
[QUOTE="svviift, post: 378095, member: 64697"] Hello DevBest, I've been editing sites and contact forms for a long time now, but it wasn't until recently where I've gained a client and was asked to put in a form, and have had major problems from day one. We're due course to launch now and I'm not quite sure what I'm doing wrong. The layout I was working from (they wanted me to use a template online because they liked it and wanted to speed up design and development) didn't have a contact form built into it per se, but did have the elements of it. Anyway, I googled a simple form and pasted the code, as follows: [INDENT][I]<form action="mail.php" method="POST"> Name <input type="text" name="name"> E-Mail<input type="text" name="email"> Message<textarea name="message" rows="6" cols="25"></textarea><br /> <input type="submit" value="Send"><input type="reset" value="Clear"> </form> <?php $field_name = $_POST['cf_name']; $field_email = $_POST['cf_email']; $field_message = $_POST['cf_message']; $mail_to = ‘email@address.com'; $subject = 'Message from a site visitor '.$field_name; $body_message = 'From: '.$field_name."\n"; $body_message .= 'E-mail: '.$field_email."\n"; $body_message .= 'Message: '.$field_message; $headers = 'From: '.$field_email."\r\n"; $headers .= 'Reply-To: '.$field_email."\r\n"; $mail_status = mail($mail_to, $subject, $body_message, $headers); if ($mail_status) { ?> <script language="javascript" type="text/javascript"> alert('Thank you for the message. We will contact you shortly.'); window.location = 'index.html'; </script> <?php } else { ?> <script language="javascript" type="text/javascript"> alert('Message failed. Please, send an email to [email]email@address.com[/email]'); window.location = 'index.html'; </script> <?php }[/I][/INDENT] I'm useless at php, so all of the PHP bit goes over my head, I've obviously created a mail.php form with the php code and put it in it, as have I got an index.html but I constantly get: [INDENT][SIZE=6][B]Internal Server Error[/B][/SIZE] The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at webmaster@[mysite].co.uk to inform them of the time this error occurred, and the actions you performed just before this error. More information about this error may be available in the server error log. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request. [/INDENT] Where do I go from here? What should I be looking at? I'm days off launching this and have only just come across the problem, the clients pushy to get live (as they always are) and I don't fancy delaying this much further as I had to push back because of uni stuff. Any suggestions? [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
Internal Server Error - Contact Forms???
Top