Reputation: 3
I got this code. I want to update mysql through textarea. I echo my MySQL in textarea, but I don't know how to update it, should I put everyting in something because _GET mode gives me nothing, also I tried to _GET "result" but its same.
<fieldset>
<form method="post" class="jNice">
<p>
<textarea>
<?php
$result = mysql_query("select html from content where name = 'pagrindinis'");
while ($row = mysql_fetch_assoc($result)) {
echo $row['html'];
}
?>
</textarea>
</p>
<?php
if (isset($_POST['keisti'])) {
$change_info = array
(
"html" => mysql_real_escape_string($_POST['html'])
);
foreach ($change_info as $info)
if (empty($info))
$klaida = "Tuščias langas";
if (empty($klaida)) {
mysql_query("UPDATE `content` SET `html` = '" . $_GET['html'] . "' where `name` = 'pagrindinis'");
echo "Informacija atnaujinta";
} else
echo $klaida;
}
?>
<input type="submit" value="Keisti" name="keisti">
</form>
</fieldset>
Or maybe you know anything better for website editing? I want to edit websites code in text area, to save space in index.php. I heard something about richtext but not much. All anwers would be good. P.S. Code editing is in admin panel.
Upvotes: 0
Views: 140
Reputation: 111
Put name tag to your textarea input -> name="html"
<textarea name="html">
<?php
$result = mysql_query("select html from content where name = 'pagrindinis'");
while($row = mysql_fetch_assoc($result)) {
echo $row['html'];
}
?>
</textarea>
Upvotes: 1