douqiaolong0528 2015-05-05 13:56
浏览 64
已采纳

PHP:在PHP中使用Curl将值发送到HTML表单

Excuse me for my question ... This has been discussed many times but i didn't notice... :( we have this html form :

<!DOCTYPE html>
<html>
<head>
<title>Comment</title>
</head>
<body>
<fieldset>
<legend align="center">Comments</legend>
<form action="server.php" method="post">
Name: <input type="text" name="name" /><br><br>
Email: <input type="email" name="email" /><br><br>
Web: <input type="url" name="web" /><br><br>
Message:<br>
<textarea name="comment"></textarea><br><br>
<input type="submit" name="send" value="send" />
</form>
</fieldset>
</body>
</html>

and this php file:

<?php
$name = $_POST['name'];
$email = $_POST['email'];
$web = $_POST['web'];
$comment = nl2br($_POST['comment']);
//database variables;
$host = "localhost";
$user = "root";
$password = "";
$db = "ashiyane";
//connect to mysql & insert data into table;
$connection = mysql_connect($host,$user,$password);
if ($connection){
    echo "Connected Successfully...";
    $select_db = mysql_select_db($db);
    if ($select_db && $name !== "" && $web !=="" && $email !=="" && $comment !==""){
        echo "<br>Database Selected...";
        $run_query = mysql_query("INSERT INTO comments (name,email,web,comment) VALUES              ('$name','$email','$web','$comment')");
        if ($run_query){
            echo "<br>Data Have Been Insert ...<br>";
        }else{
            echo "<br>Inserting Data Failed!";
        }
    }else{
        echo "<br>Database No Selected!";
    }
}else{
    echo "<br>Connecting Failed!";
}
//show results;
$show_query = mysql_query("SELECT * FROM comments");
while ($results = mysql_fetch_array($show_query)){
    echo $results['name']." : ".$results['email']." : ".$results['web']." : ".$results['comment']."<br>====================<br>";
}
?>

Now we want our values to send HTML form with curl functions ... please help me ... Once again I apologize for asking this question... :) Thanks All Friend !! ;)

  • 写回答

1条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥15 实值特征权重向量和特征选择,多分类
      • ¥15 INVEST年产水量模块结果出处理
      • ¥15 Neo4j 不显示关系
      • ¥15 这段代码有什么bug
      • ¥15 pip默认安装位置修改不成功
      • ¥15 C++ inline、staitc、const三合一谁能讲通透
      • ¥15 关于pyqt5中QThread的问题
      • ¥20 STM32基于HAL库使用串口发送16进制数组
      • ¥15 OpenCV报错 You can enable it via 'OPENCV_IO_ENABLE_OPENEXR'
      • ¥15 AT89C51的程序问题