[PHP] What's wrong with this....
I have the following code, whatit's supposed to do is display the data from the mySQL database and display in a text box, but it isn't.
PHP Code:
<?php
include "config.php";
$id = $_GET["id"]; // Be sure to use a good clean function to do it with. If you have one uncomment the next line
# $id = Clean($_GET["id"]);
if($_GET["action"] == "edit") {
$name = $_POST["name"];
# $field = clean($_POST["field"]);
$grade = $_POST["grade"];
$comment = $_POST["comment"];
mysql_query("UPDATE petition SET name='$name', grade='$grade', comment='$comment' WHERE id='$id'") or die(mysql_error());
echo "Record updated!";
exit;
}
$get = mysql_query("SELECT * FROM table WHERE id='$id' LIMIT 0,1");
$row = mysql_fetch_array($get);
?>
<form action="?action=edit" method="post">
Name: <input name="name" type="text" value="<?php
$get_current = mysql_fetch_array(mysql_query("select name from petition where id = '$id'"));
echo('$get_current["name"]');
?>"/><br />
Grade: <input name="grade" type="text" value="<?php
$get_current = mysql_fetch_array(mysql_query("select grade from petition where id = '$id'"));
echo('$get_current["grade"]');
?>"/><br />
Comment:<br />
<input name="comment" type="text" value="<?php
$get_current = mysql_fetch_array(mysql_query("select comment from petition where id = '$id'"));
echo('$get_current["comment"]');
?>"/><br />
<input type="submit" value="Edit Comment!" />
</form>
Moved by Agesilaus (Forum Moderator) from Design and Development: Please post in the correct forum in future.