Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
希望将值设置为输入类型文本,然后将表单从javascript发布到php_Php_Javascript_Forms_Variables - Fatal编程技术网

希望将值设置为输入类型文本,然后将表单从javascript发布到php

希望将值设置为输入类型文本,然后将表单从javascript发布到php,php,javascript,forms,variables,Php,Javascript,Forms,Variables,id不希望将值放入文档中。getElementById(“UniLoc”)。value=val并且它不想提交表单。如何解决此问题 这就是我如何调用函数JSnas一些值“asd56” 使用 如果您的完整表格没有其他问题,则应提交。如果尚未关闭表单标记,请将其关闭 </form> 我不能从你的问题中真正判断出什么是错的,但看看你的代码: document.getElementById('UniLoc').innerHTML=val; 您试图设置id为“UniLoc”的输入值,但使用了

id不希望将值放入
文档中。getElementById(“UniLoc”)。value=val并且它不想提交表单。如何解决此问题

这就是我如何调用函数
JS
nas一些值“asd56”

使用

如果您的完整表格没有其他问题,则应提交。如果尚未关闭表单标记,请将其关闭

</form>

我不能从你的问题中真正判断出什么是错的,但看看你的代码:

document.getElementById('UniLoc').innerHTML=val;
您试图设置id为“UniLoc”的输入值,但使用了错误的语法。使用.value代替.innerHTML

document.getElementById('UniLoc').value=val;

尝试在php all中而不是在函数中创建一个if子句,该子句将执行表单发布操作的代码,并在php请求时尝试以下操作

 if($JS!="" )
 {

 $UniLoc=$JS;
 $JS="something that will go throught the other if down at the code";

  }
 else {

  $UniLoc=$_POST["UniLoc"];
 }
</form>
document.getElementById('UniLoc').innerHTML=val;
document.getElementById('UniLoc').value=val;
 if($JS!="" )
 {

 $UniLoc=$JS;
 $JS="something that will go throught the other if down at the code";

  }
 else {

  $UniLoc=$_POST["UniLoc"];
 }