Hey everyone,

I am not quite positive where to post this as this issue may involve more than just one coding language. I am a experienced html/css/php/mysql coder who has been delving into Javascript/XML/AJAX coding.

Here is what I am attempting to accomplish using a picture of praying hands as a button with an onclick event.

1. Button is displayed as praying hands that say "Please pray for me".
2. User/Guest clicks on button.
3. Username and Prayer Post ID are passed to the prayFor JS function
4. PrayFor JS function passes Username and Prayer Post ID onto a separate PHP file and the JS changes the original image to one of praying hands that states "Thank You!" on them.

So far the code works as intended, however when I am passing the prayer ID and then the username and somewhere along the way the username is getting lost as the php files that the JS calls on cannot see that variable. Also the prayer ID is an int and the username is a string.

Here is what I have so far code wise.

Javascript/XML bit
Code:
<script type="text/javascript">
var xmlhttp;
function prayFor(i,u){
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	}else{// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	xmlhttp.onreadystatechange=function(){
		if(xmlhttp.readyState==4 && xmlhttp.status==200){
			document.getElementById("prayFor"+i).innerHTML=xmlhttp.responseText;
		}
	}
	
	xmlhttp.open("GET", "prayerInc.php?i="+i+"&u="+u);
	xmlhttp.send();
}
</script>
HTML/PHP bit
Code:
<?php $id = 1; $un='Serihon'; ?>
<input type="image" src="images/prayingHands.png" alt="praying hands" onclick="prayFor('<?php echo $id; ?>','<?php echo $un; ?>');" />
Any help with this would be greatly appreciated!

Serihon