PHP: get_post ile ilgili bir sorun yaşıyorsunuz

0 Cevap php

Ben get_post yöntemi ile bir sorun yaşıyorum. İşte benim kod:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Upload2</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>

<body>  

<h1> Welcome to my search Engine </h1>

<?php

# SETUP
$thisFile = 'v4.php';

# INPUT FIELDS
echo <<< END
<form action="$thisFile" method="post">
<pre>
Search <input type="text" name="searchTerm"/>
       <input type="submit" value="Add Record"/>
</pre>
</form>
END;

# EXTRACT INPUTTED FIELDSA
if(isset($_POST['searchTerm'])) {

        # INITIALIZE INPUTTED VARIABLES
        $mySearchTerm = get_post('searchTerm'); # <- PROBLEM LINE!
        echo "You searched for: $mySearchTerm";
}

?>

</body>
</html>

Bir arama terimi girilmeden önce kod iyi çalışıyor. Beklenen ve bu sayfayı bir tarayıcıda görüntülenir gibi html görünüyor:

alt text

Bir arama terimi girin sonra sayfaları aynı görünüyor ama bakış gittikten sonra -> Sayfa Kaynağını ilginç bir şey fark ettim. Sayfanın sonunda, bu gibi görünüyor:

Search <input type="text" name="searchTerm"/>
       <input type="submit" value="Add Record"/>
</pre>
</form>

NOTE:, herhangi bir bitiş yoktur </body></html>

0 Cevap