/www/formulair.php
的代码:
<html>
<head>
</head>
<body>
<form action="recive.php" method="POST">
<input type="text" name="name"/>
<input type="submit" value="Send me your name!">
</form>
</body>
</html>
/www/recive.php
的代码:
<?php
include ("config.php");
?>
/www/config.php
的代码:
<?php
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,'http://localhost/test.php');
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $_POST['name']);
curl_exec($ch);
curl_close($ch);
?>
test.php
的代码:
<?php
if(isset($_POST['name'])) {
$fp = fopen('data.txt', 'a+');
fwrite($fp,$_POST['name']);
fclose($fp);
}
?>
错误:
Erreur:注意:未定义的变量
我应该在test.php
写些什么来获取$_POST['name']
?