我正在创建对下一页的引用,因此<a href="changePakett.php?pakett_id=<?=$pakett['pakett_id']?> ">change</a>
点击网址中的链接后,我得到了结果/changePakett.php?pakett_id=1
。这是我需要的结果,但我有一个问题。现在我在查询中需要pakett_id的值,但我无法得到它
if(isset($_GET['pakett_id'])){
$pakett_id = $_GET['pakett_id'];
if(isset($_GET['changepakett'])){
$connection = db_connect();
if($connection)
{
$kirjeldus = $_GET['kirjeldus'];
$hetke_hind = $_GET['hetke_hind'];
//invisible there
echo $pakett_id;
}else echo "Can't connect to DataBase";
}
}else echo "Sorry, don't understand which pakett you want to change =(";
当我检查它是否被设置时,我的$_GET['pakett_id']
是可见的,但是在另一个内部看不见(参见代码中的注释)。我怎么能把它拿到看不见的地方?
更新:
changePakett.php form
<form action="../lib/functions.php" method="get">
<input type="text" name="kirjeldus" placeholder="kirjeldus"/>
<input type="text" name="hetke_hind" placeholder="hetke_hind"/>
<input type="submit" name="changepakett" value="change"/>
</form>
答案 0 :(得分:2)
没有$_GET['changepakett']
所以if
语句中的代码永远不会执行。 changePakett.php
是您所在文件的名称。
在您开发时使用它,它将使您的生活更轻松:
error_reporting(E_ALL);
ini_set('display_errors', '1');