我有這樣的代碼來獲取文件中的信息並顯示結果。這一切都按預期工作。我無法做的是在按下按鈕時將按鈕的值導出,這樣按下按鈕的值就會轉移到我的php函數中的一個變量中。我怎樣才能做到這一點?在php函數中導入html值
下面的代碼:
<h2>Demmarage script torrent</h2>
<form action="search.php" method="POST">
<input type="text" name="input_value">
<input type="submit" name="submit">
<?php
echo "<br>";
if (isset($_POST['submit'])){
$findme = $_POST['input_value'];
$findme1 = str_replace (" ", ".", $findme);
$savedarr = unserialize(file_get_contents('torrent.bin'));
foreach ($savedarr as $val1){
$mystring = $val1['title'];
if((stripos($mystring, $findme) !== false) or (stripos($mystring, $findme1) !== false)) {
echo "Show trouve: ";
echo $mystring;
?>
<button type="submit" value="<?php echo $val1['link']; ?>" name="editId">Telecharger</button>
<?php
echo "<br>";
}
}
}
if (isset($_POST['editId'])){
//Here i want to import the value of the pressed button to do something
echo "download start";
}
?>
感謝就是這樣,它的工作。再次感謝。 – user3199862