my php is very "weak" so I am having trouble with this -
<?php
include_once "../scripts/connect_to_mysql.php";
$title = $_POST['title'];
$desc = $_POST['description'];
$query = mysql_query("UPDATE images SET title='$title', description='$desc'") or die (mysql_error());
echo 'Operation Completed Successfully! <br /><br /><a href="index.php">Click Here</a>';
exit();
?>
The undefined index error is description
on line 9 which is $desc = $_POST['description'];
and "description" is in the database spelling is also right.
Try doing:
if(isset($_POST['description'])){echo "yes";}else{echo "no";}
This wont fix it but it will help determing whether $_POST['description'] exists.. Also, what is the source of $_POST['description']
?, is it set in ../scripts/connect_to_mysql.php
? How?
Unless performing more complex tasks (i.e. AJAX), POST variables are typically set by submitting a form- does your code come after the page is loaded following a form submission? If not, you may be incorrectly using _POST variables...
If $_POST['description']
is set somewhere in the code of ../scripts/connect_to_mysql.php
, and by including the file you wish to then retrieve its value- you may be going about things wrongly- can you provide information about the origin of $_POST['description']
?