javascript - 如何将多个参数从javascript转换为html表单

标签 javascript html forms

这是我正在尝试的代码

<script>
 var output = "<table id='e' border><tr><td><input type='text' id=/"t"/></td><td><input type='text' id=/"t1/"></td><td><input type='text1' id=/"t2"/></td><td><input type='text1' id=/"t3"/></td><button onclick=del('"+ divId +"')>delete</button></td></tr></table>";

</script>

<body>
<form method=post action="t.php">
<input type="text" id= ??(from script...)
</body>

为了将脚本中的参数发送到文本字段中一一形成,我要做什么 shell?有没有可能?

最佳答案

在 PHP 中:

<?php 
if($_POST['submit'])
{
    $user = $_POST['user'];
    $pass = $_POST['pass'];
    //Here you have the text in php variables. You can do whatever you want with them
}
?>

<form method="post" enctype="multipart/form-data" name="form">
    Username: <input type="text" name="user" required>
    Password: <input type="password" name="pass" required>
</form>

关于javascript - 如何将多个参数从javascript转换为html表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21168957/

相关文章:

html - 水平对齐图像 CSS

javascript - 幻影文本 - 如何在文本框中显示微弱的文本

javascript - 当焦点位于特定输入时,如何防止表单提交?

php - 用表单发送固定数据

javascript - 为什么 2 个 parseFloat 变量的总和给我一个不正确的十进制数

php - 从一个页面获取一个id并将其存储在另一个页面中

php - 使用 JS 和 PHP 将文本区域内容保存到文件中

JavaScript:使用子字符串获取字符串的一部分

javascript - 如何按字母顺序对下拉列表进行排序

jQuery更改表单ID并提交 "new"表单