提交表单...用php创建 [英] submit form...created with php
问题描述
我知道这不是一个php小组,但我想知道我的问题是否在我的php代码中使用了我的
javascript。我正在调试其他人的代码而且我不能确定这个表格不会提交的原因。
此代码什么都不做:
<?PHP
$ var1 =" http://localhost/php/index.php" ;;
$ varx =" bruce";
echo"< form name =''formx3''method =''post''>< input type =''text' '>< input
type = button value = go onclick = document.formx3.action =''"。$ var1。"'';
document .formx3.submit();>< / form>" ;;
?>
此代码有效,但我想知道原因上面的代码没有。
<?PHP
$ var1 =" http://localhost/php/index.php" ;;
$ varx =" bruce";
echo"< form name =''formx2''action =''"。$ var1。"''>< ; input type =''text''>< input
type = button value = go onclick = document.formx2.su bmit();>< / form>" ;;
?>
即使尝试分配表单操作也似乎很奇怪然后在onclick事件中提交
...你允许在Javascript中执行此操作吗?
提前致谢...
-Bruce
I know this isn''t a php group but I was wondering if my problem is with my
javascript in my php code. I''m debugging someone else''s code and I can''t
figure out why this form won''t submit.
This code doesn''t do anything:
<?PHP
$var1 = "http://localhost/php/index.php";
$varx = "bruce";
echo "<form name=''formx3'' method=''post''><input type=''text''><input
type=button value=go onclick=document.formx3.action=''".$var1."'';
document.formx3.submit();></form>";
?>
This code works, but I want to know why the above code doesn''t.
<?PHP
$var1 = "http://localhost/php/index.php";
$varx = "bruce";
echo "<form name=''formx2'' action=''".$var1."''><input type=''text''><input
type=button value=go onclick=document.formx2.submit();></form>";
?>
It seems awful weird to even try to assign the forms action and then submit
it all in the onclick event...are you allowed to do this in Javascript?
Thanks in advance...
-Bruce
推荐答案
var1 =" http://localhost/php/index.php" ;;
var1 = "http://localhost/php/index.php";
varx =" bruce";
echo"< form name =''formx3''method =''post''>< input type =''text''>< input
type = button value = go onclick = document.formx3.action =''"。
varx = "bruce";
echo "<form name=''formx3'' method=''post''><input type=''text''><input
type=button value=go onclick=document.formx3.action=''".
var1 。"'';
document.formx3.submit();>< / form>" ;;
?>
>
这段代码有效,但我想知道为什么上面的代码没有。
<?PHP
var1."'';
document.formx3.submit();></form>";
?>
This code works, but I want to know why the above code doesn''t.
<?PHP
这篇关于提交表单...用php创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!