<?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'] . ".";
?>
I'm just beginning to learn, so bear with me. So, my url ends like so: index.php?id=3
, but my $_GET['id'];
line doesn't actually get the id. Instead, I keep getting the error undefined index: id
. I've tried changing it to _POST
and _REQUEST
, but neither of those work. What gives? This code has worked for me in the past, but for some reason is not working now.
edit:
error message: "Notice: Undefined index: id in C:\xampp\htdocs\MeetingCost2\Calculator\process_form.php on line 6"
full url: http://localhost/MeetingCost2/Calculator/index.php?id=3