<?php
mysql_connect("127.0.0.1", "root", "");
mysql_select_db("meetings");
$id = $_GET['id'];
if(isset($_POST['meeting_cost']) && !empty($_POST['meeting_cost'])){
// do your database operations here
echo "Success.";
$cost = mysql_escape_string($_POST['meeting_cost']);
echo "<br>" . "<br>" . "Cost is " . $cost . ".";
mysql_query("UPDATE `meeting_info` SET cost='$cost' WHERE meeting_id='$id'") or die(mysql_error());
}else{
echo "[Failed to retrieve meeting cost.]";
}
//echo "Okay, cost is " . $_POST['working'] . ".";
?>
我刚开始学习,所以请耐心等待。
所以,我的网址结尾如此:index.php?id=3
,但我的$_GET['id'];
行实际上并未获得ID。相反,我不断收到错误undefined index: id
。我尝试将其更改为_POST
和_REQUEST
,但这些都不起作用。
是什么赋予了?这段代码过去对我有用,但由于某些原因现在不能正常工作。
编辑:
error message: "Notice: Undefined index: id in C:\xampp\htdocs\MeetingCost2\Calculator\process_form.php on line 6"
完整网址:http://localhost/MeetingCost2/Calculator/index.php?id=3