😕
Okay so I am working with ajax now and I was doing good until one of my scripts decided not to load or cannot load I'm not sure what it is...
So here is what I have done,
1)Made sure the database was connected right.
2)over look the scripts for minor spelling errors (Misplaced letters/ Unneeded caps.)
3)Compair with other working scripts.
So this worked when I was on a different server but I moved some stuff around to make it work with a different script.
To start with here is the page I work everything from so far. The index
index.php
<html>
<table class="main">
<tr class="head"><td>
<head>
<meta http-equiv="expires" content="text/html; charset=utf-8" />
<?php include("head.php"); ?>
<script src="ajax.js" type="text/javascript"></script>
<script src="dom.js" type="text/javascript"></script>
<script src="homefunctions.js" type="text/javascript"></script>
</head>
</tr></td>
<tr><td>
<body>
<div id="body"><h2>Story Line...</h2><br>The story line.<br><br><h2>News</h2><table class="news" border="1"><tr><th>Date Added</th><th>Updates</th></tr><tr><td>January 4, 2009</td><td>Updates go here.</td></tr></table></div>
</body>
</tr></td>
<tr><td>
<div id="foot">
<?php include("foot.php"); ?>
</div>
</td></tr>
</table>
</html>
The two base include files are.
dom.js
function $(id){
return document.getElementById(id);
}
function fillDiv(id,data){
$(id).innerHTML = data;
}
and
homefunctions.js
/*This is only the piece I want to work with at the moment to try and solve the registry problem too.*/
function startContact(){
email = $("EmailFrom").value;
username = $("Name").value;
information = $("Contact").value;
data = "email=" + email + "&username=" + username + "&information=" + information;
evalpostAJAXHtml("contactsend.php",data,0);
}
Now the code that goes into the index.php is
contact.php
<?php
$data = "<h2>Contact</h2><br><p>Fields marked (*) are required.<br><br> Please report all bugs, spelling errors, or account difficulties here! Thank you.</p><form name=contactForm><p>Your Email:* <br><input type=text name=EmailFrom><p>Your Username(NOT Login name):*<br><input type=text name=Name><p>Problem:<br><textarea name=Contact cols=60 rows=5></textarea><p><input type=button id=submit value=submit onclick=startContact();></form>";
print("fillDiv('body','".$data."');");
?>
and finally here is the process form
contactsend.php
<?php
$email = Trim(stripslashes($_POST['email']));
$EmailTo = "protector_of_man_kind@hotmail.com";
$Subject = "Bug/spelling/character error report.";
$username = Trim(stripslashes($_POST['username']));
$information = Trim(stripslashes($_POST['information']));
$validationOK=true;
if (Trim($email)=="") $validationOK=false;
if (!$validationOK) {
print("fillDiv('body','Please put in your email. <a href=Javascript: viewContact();>Back</a>');");
}
$validationOK=true;
if (Trim($username)=="") $validationOK=false;
if (!$validationOK) {
print("fillDiv('body','Please put in your username. <a href=Javascript: viewContact();>Back</a>');");
}
$Body = "";
$Body .= "Name: ";
$Body .= $username;
$Body .= "\n";
$Body .= "Contact: ";
$Body .= $information;
$Body .= "\n";
$success = mail($EmailTo, $Subject, $Body, "From: <".$email.">");
if ($success){
print("fillDiv('body','Your message was sent! Thank you!');");
}
else{
print("fillDiv('body','There was an error sending your message <a href=Javascript: viewContact();>Back</a>');");
}
?>
It just doesn't make it to the contactsend piece of the script and doesn't finish.
Does anyone have a clue what the problem is?