[Problem] PHP getting info from JavaScript

hi guys
i’m trying to make a simple upload-form, with java-script, php-mysql, and DOM. some people would call it ajax.
so the (simple) idea is, when u press the submit btn, java-script checks if everything is not empty(this part works fine), then java-script asks u if u want to upload it(works also)then if u press yes, php loads the data to a mysql-database.but i cant get it work, heres my script so far:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Unbenanntes Dokument</title>
<script type="text/javascript">
function send(i){
var bod = window.document.documentElement.childNodes[1];
var rot = window.document.documentElement.childNodes[1].childNodes[1].childNodes[1].childNodes[1];
if(i==1){
if(rot.childNodes[0].childNodes[2].childNodes[0].value==""){
rot.childNodes[0].childNodes[2].childNodes[0].style.backgroundColor="rgb(255,51,51)";
alert ("Name vergessen");
}else{
rot.childNodes[0].childNodes[2].childNodes[0].style.backgroundColor="rgb(255,255,255)"
var na = true;
};
if(rot.childNodes[1].childNodes[1].childNodes[0].value==""){
rot.childNodes[1].childNodes[1].childNodes[0].style.backgroundColor="rgb(255,51,51)";
alert ("Typ vergessen");
}else{
rot.childNodes[1].childNodes[1].childNodes[0].style.backgroundColor="rgb(255,255,255)";
var ty = true;
};
if(rot.childNodes[2].childNodes[1].childNodes[0].value==""){
rot.childNodes[2].childNodes[1].childNodes[0].style.backgroundColor="rgb(255,51,51)";
alert ("Material vergessen");
}else{
rot.childNodes[2].childNodes[1].childNodes[0].style.backgroundColor="rgb(255,255,255)";
var ma = true;
};
if(rot.childNodes[3].childNodes[1].childNodes[0].value==""){
rot.childNodes[3].childNodes[1].childNodes[0].style.backgroundColor="rgb(255,51,51)";
alert ("Ort vergessen");
}else{
rot.childNodes[3].childNodes[1].childNodes[0].style.backgroundColbvgor="rgb(255,255,255)";
var or = true;
};
if(rot.childNodes[4].childNodes[3].childNodes[0].value==""){
rot.childNodes[4].childNodes[3].childNodes[0].style.backgroundColor="rgb(255,51,51)";
alert ("Objekt vergessen");
}else{
rot.childNodes[4].childNodes[3].childNodes[0].style.backgroundColor="rgb(255,255,255)";
var ob = true;
};
if(rot.childNodes[5].childNodes[3].childNodes[0].value==""){
rot.childNodes[5].childNodes[3].childNodes[0].style.backgroundColor="rgb(255,51,51)";
alert ("Großes Bild vergessen");
}else{
rot.childNodes[5].childNodes[3].childNodes[0].style.backgroundColor="rgb(255,255,255)";
var gb = true;
};
if(rot.childNodes[6].childNodes[3].childNodes[0].value==""){
rot.childNodes[6].childNodes[3].childNodes[0].style.backgroundColor="rgb(255,51,51)";
alert ("Kleines Bild vergessen");
}else{
rot.childNodes[6].childNodes[3].childNodes[0].style.backgroundColor="rgb(255,255,255)";
var kb = true;
};
if(kb&&gb&&ob&&or&&ma&&ty&&na){
alert ("gut");
 if (confirm("Hochladen?"))
          document.f.ak.value = "up";
       else
          return;
}
}
}
</script>
</head>

<body>
<?php
if (isset($ak))
 {
 if($ak=="up"){
?>hallo<?php
 }
 else{
?>hi<?php
 }
 }
 ?>hach<?php
?>
<form name="f" action="upload.php" method="post">
<table>
<tr>
<td>
Name</td><td><input type="text" value="namelchen"/></td></tr><tr><td>
Typ</td><td><input type="text" value="typlchen"/></td></tr><tr><td>
Material</td><td><input type="text" value="materialchen"/></td></tr><tr><td>
Ort</td><td><input type="text" value="ortlchen"/></td></tr><tr>
  <td>
Objekt</td>
  <td><input type="text" value="objektlchen"/></td></tr><tr>
    <td>
Großes Bild</td>
    <td><input type="file"/></td></tr><tr>
      <td>
Kleines Bild</td>
      <td><input type="file"/></td></tr></table>
<input type="button" value="Fertisch" onclick="send(1)"/>
<input type="hidden" name="ak">
</form>
</body>
</html>


aso u can see theres no mysql-upload in the script, i first tried to simply let php get the var
i dont know if i made a mistake or if i forgot something.
please help me out