I am using a php script to allow my friend to edit pages on our web server. The code seems to work and the success message shows but when I go into the mysql database sectionone is empty.
Form:
<?php
require '/home/factcats/public_html/admin/connection2.php';
mysql_connect($host, $user, $pass);
mysql_select_db($db);
$result = mysql_query("SELECT * FROM `background`");
while($row = mysql_fetch_assoc($result)){
?>
<section>
<div class='row'>
<form action="process.php" method="post">
<div>
<label for="sectionone">Section One</label>
<textarea value="" class="form-control" type="text" size="300" name rows="20" = "sectionone"><?php
echo "".$row['sectionone'].""; ?> </textarea>
</div>
<div>
<label for="sectiontwo">Section Two</label>
<textarea value="" class="form-control" type="text" size="300" rows="20" name = "sectiontwo"><?php
echo "".$row['sectiontwo'].""; ?></textarea>
</div>
<br>
<input class="btn btn-primary" name="submit" type="submit" value="Update"/>
</form>
</div>
</DIV>
<?php
}
?>
Process.PHP:
<?php
$sectionone=addslashes($_POST['sectionone']);
$sectiontwo=addslashes($_POST['sectiontwo']);
if(isset($_POST['submit'])) {
require '/home/factcats/public_html/admin/connection2.php';
mysql_connect($host, $user, $pass);
mysql_select_db($db);
mysql_query("UPDATE `background` SET sectionone='$sectionone', sectiontwo='$sectiontwo' WHERE id=1");
} else {
Print "Something went wrong please go back!";
}
?>
What's even stranger is that section two saves fine.