Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/242.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.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
Php 如何清除url_Php_Url - Fatal编程技术网

Php 如何清除url

Php 如何清除url,php,url,Php,Url,我需要一些帮助。。。 当我单击提交url时 我如何使其明确到: 当我开始的时候 <?php $guest = file_get_contents("kommentar.txt"); if(isset($_GET["name"])){ $name = $_GET["name"]; $comment = $_GET["comments"]; $guest .= $name . "<br>" . $comment . "<br>"; $data = file_pu

我需要一些帮助。。。 当我单击提交url时

我如何使其明确到: 当我开始的时候

<?php
$guest = file_get_contents("kommentar.txt");

if(isset($_GET["name"])){
$name = $_GET["name"];
$comment = $_GET["comments"]; 
$guest .=  $name . "<br>" . $comment . "<br>";
$data = file_put_contents("kommentar.txt", $guest);
}

?>

<!DOCTYPE html>

<html>
<head>
    <meta charset="uft-8">
    <title>Thomas Hansen</title>
    <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
    <link href="special.css" rel="stylesheet" type="text/css"> 
</head>

<body>

 <h1>Apple</h1>

<form action="dag5_3.php" method="get">
<label for="name"></label> <input type="text" name="name" id="name" placeholder="Navn"><br>
<textarea rows="4" cols="50" placeholder="Kommentar" id="comments"></textarea>
<input type="submit" value="Send">  
</form>

<?php

    //echo udskriver
    echo "Du er viewer nummer: " . $count . "<br>" . "<br>" . "<br>";    

    echo "$guest";

 ?> 
 <script src="dag1.js"></script>

 </body>

 </html>

托马斯·汉森
苹果


您的文本区域应该是

<textarea rows="4" cols="50" placeholder="Kommentar" id="comments" name="comments"></textarea>
                                                                   ^.............^

^.............^

您忘记了文本区域上的“name=“comments!”,哈哈,不可能!。。谢谢你知道为什么每次我刷新页面时,它都会复制til.txt中的文本并再次插入吗D