Possible Duplicate:
PHP: “Notice: Undefined variable” and “Notice: Undefined index”
When I hit submit on my on page the info does go into the database but I keep on getting undefined for some and im not getting the bounce data from sample in the javascript.
Notice: Undefined index: sample in
<div id="have">< id="<?php echo 'sample' ?>" onChange="calcnum()"width="500"
height="500" style="border:1pt solid black"></div>
<input type="hidden" name="number" id="number" />
<form action="<?php echo $editFormAction; ?>" method="POST" name="form">
<input name="save" type="hidden" value="<? echo $_POST['sample']?>" />
<input name="submit" type="submit" onChange="calcnum()" value="submit" />
<input type="hidden" name="MM_insert" value="savelayout" />
</form>
And java -
<script type="text/javascript">
function calc()
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
val1 = document.getElementById("sample").value;
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("sample").innerHTML=xmlhttp.responseText;
document.getElementById("sample").value = xmlhttp.responseText;
}}
}
</script>
Any pointers would greatly be appreciated thanks :)