I'm curious as to where my issue seems to be... I tried to use the $id=$_GET['id']
command in order to collect the id and allow my sql row to be updated. Can anyone help me and see what it is I'm doing wrong?
Here's my database line up:
||idtest||testing
and the current update PHP:
<?php
include("database_conn_test.php");
?>
<?php
//select database table
$sql = "SELECT testing FROM test";
$queryresult = mysql_query($sql) or die (mysql_error());
//Request Values
while ($res = mysql_fetch_array($queryresult)){
$algemeneVoorwaarden = $res['testing'];
}
if(mysql_num_rows($queryresult) <= 0) {
echo("");
}
if(isset($_POST['update'])){
$id = $_GET['id'];
$res= mysql_query("SELECT * FROM test WHERE idtest=$id");
$avID= mysql_fetch_array($res);
$algemeneVoorwaarden = mysql_real_escape_string($_POST['testing']);
$updateAV = "UPDATE test SET testing=$algemeneVoorwaarden WHERE idtest=$avID";
$result = mysql_query($updateAV);
}
?>
And last but not least the HTML:
<div class="tinyMCEWrapper">
<script src="tinymce/tinymce.min.js"></script>
<script type="text/javascript">tinymce.init({selector: "textarea"});</script>
<form method="post" action="test.php?id=<?php echo $id; ?>">
<textarea name="testing" id="content" class="algemeneAdmin" style="width:100%"><?php echo $algemeneVoorwaarden; ?>
</textarea>
<input type="hidden" name="id" value = "<?php echo $id; ?>">
<button type="submit">Post</button>
</form>
</div>
UPDATE: I have figured out the area of incidence, but not how to fix it. I am doing something wrong with $id as it never receives a value...