Hi all,
Hope this is the right spot for this as the question contains html, php and js…
I have a problem with a contact form. Everything behaves as it should (the form is sent, an acknowledgement is shown to the person sending the form and the completed form arrives as the correct destination) except that message cuts off at around 300 characters [I]even though the message is shown in the ‘message’ field on the page
Code is below
Thanks!
—————— form——————
<form name=”contactform” id=”contactform” method=”post” action=”contact.php”>
<span class=”inputlabel”>Name:</span><br />
<input name=”name” type=”text” class=”searchbox” id=”name” size=”24″ maxlength=”50″ />
<span class=”inputlabel”>Email:</span><br />
<input name=”email” type=”text” class=”searchbox” id=”email” size=”24″ maxlength=”30″ />
<span class=”inputlabel”>Organisation (if appropriate):</span><br />
<input type=”text” name=”subject” class=”searchbox” id=”subject” size=”24″ />
<span class=”inputlabel”>Your message:</span><br />
<textarea name=”msg” cols=”45″ rows=”8″ id=”textarea”></textarea>
<br />
<input type=”button” value=”Send email” name=”send” onclick=”sendemail();” id=”submitbutton” />
</form>
——————processor——————
<?php
$to = “
$subject = “From the website”; //Use this if you want to have a prefix before the subject
if(!isset($_GET[‘action’]))
{
die(“You must not access this page directly!”);
}
$name = trim($_GET[‘name’]); //The senders name
$email = trim($
$message = trim($_GET[‘msg’]); //The senders message
mail($to,$subject,$message,”From: “.$email.””); //a very simple send
echo ‘form|<h4> Dear ‘.$name.’, <br /><br />Thank you for your message. We check our email regularly and will be in touch shortly. </h4>’;
?>
——————js.——————
function createRequestObject() {
var ro;
var browser = navigator.appName;
if(browser == “Microsoft Internet Explorer”){
ro = new ActiveXObject(“Microsoft.XMLHTTP”);
}else{
ro = new XMLHttpRequest();
}
return ro;
}
var http = createRequestObject();
function sendemail() {
var msg = document.contactform.msg.value;
var name = document.contactform.name.value;
var email = document.contactform.email.value;
var subject = document.contactform.subject.value;
document.contactform.send.disabled=true;
document.contactform.send.value=’Sending….’;
http.open(‘get’, ‘contact.php?msg=’+msg+’&name=’+name+’&subject=’+subject+’&email=’+email+’&action=send’);
http.onreadystatechange = handleResponse;
http.send(null);
}
function handleResponse() {
if(http.readyState == 4){
var response = http.responseText;
var update = new Array();
if(response.indexOf(‘|’ != -1)) {
update = response.split(‘|’);
document.getElementById(update[0]).innerHTML = update[1];
}
}