svviift
New Member
- Dec 6, 2015
- 17
- 6
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:
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:
Any suggestions?
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:
<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 protected]';
$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 protected]');
window.location = 'index.html';
</script>
<?php
}
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 protected]';
$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 protected]');
window.location = 'index.html';
</script>
<?php
}
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:
Internal Server Error
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.
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.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.
Any suggestions?