Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/sql-server-2008/3.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
Html 如何将textarea数据发送到另一个页面?_Html_Post - Fatal编程技术网

Html 如何将textarea数据发送到另一个页面?

Html 如何将textarea数据发送到另一个页面?,html,post,Html,Post,我对这类事情还不熟悉。。。我需要将3个文本区域中的数据提交到另一页… 我该怎么做? 另外,如果可以的话,我会使用输入。您需要使用表单创建页面。。。例如,将其命名为form.html 例如,使用以下代码: <form id="form1" name="form1" method="post" action="acceptpage.php"> <input type="text" name="input" id="textfield" /> <textare

我对这类事情还不熟悉。。。我需要将3个文本区域中的数据提交到另一页…
我该怎么做?

另外,如果可以的话,我会使用输入。

您需要使用表单创建页面。。。例如,将其命名为form.html 例如,使用以下代码:

  <form id="form1" name="form1" method="post" action="acceptpage.php">
  <input type="text" name="input" id="textfield" />
  <textarea name="text" id="textarea" cols="45" rows="5"></textarea>
  <input type="submit" name="button" id="button" value="Send" />
  </form>
并使用

2015年3月15日更新

PHP自2011年以来发生了很多变化。mysql\u connect的函数
。改用mysqli或PDO

参考:


您熟悉任何服务器端脚本吗?嗯。。。。。。??PHP,这就是我将要用来获取结果并将其放入数据库的内容。我还使用它来检索一些数据并将其放入文本区域@yankee,根据W3规范,那不行。我将尝试一下。当您使用表单发送数据时,首先您对
name=“somethnig”
感兴趣,也可以制作不同的id,根据需要调用它们。对于更复杂的事情,这将是重要的。另请参阅我的编辑,在数据库中插入数据。这很重要,因为mysql\u real\u escape\u字符串。。。但是我已经知道PHP和转义大文本的函数,因为它们可能会干扰SQL标记和所有这些。。。我只是不知道文本区域可以通过POST发送。:)
<?php
$frominput = $_POST[input]; // Variable who accept your data from input
$fromtextarea = $_POST[text]; // Variable who accept your data from textarea
// You don't need to use variables, but if you starter, easier to understand.
    // Do something with your arrived data... 
// Stupid, but for short explanation... for example echo it...
echo $fromtextarea;
echo $frominput;
?>
<?php
$frominput = mysql_real_escape_string($_POST[input]);
$fromtextarea = mysql_real_escape_string($_POST[text]);
// Do something with your arrived data... 
$query = mysql_query("INSERT INTO table (rowforinput, rowfortextarea) VALUES
    ('$frominput','$fromtextarea')") or die (mysql_error());
?>
        function connect_db() {
        mysql_connect("localhost", "username", "password");
        mysql_select_db("database");
                      }