gpt4 book ai didi

php - 未定义索引 : submission with html5

转载 作者:行者123 更新时间:2023-11-29 14:06:10 26 4
gpt4 key购买 nike

Possible Duplicate:
PHP: “Notice: Undefined variable” and “Notice: Undefined index”

当我在页面上点击“提交”时,信息确实会进入数据库,但有些信息仍然未定义,而且我没有从 JavaScript 中的示例中获取退回数据。


注意:未定义索引:样本位于

<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>

和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>

任何指示将不胜感激,谢谢:)

最佳答案

要修复未定义的错误,请更改以下内容:

<? echo $_POST['sample']?>

对此:

<? if (isset($_POST['sample'])) {echo $_POST['sample'];} ?>

关于php - 未定义索引 : submission with html5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14310482/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com