My code and form:
<?php
include("includes/connect.php");
$content = "SELECT * FROM content where content_page='home'";
$result = mysql_query($content);
$row = mysql_fetch_array($result);
?>
<form method="post" action="admin_home.php">
Headline:</br>
<input type="text" name="content_title" value="<?php echo "$row[content_title]" ?>"></br> </br>
Main content:</br>
<textarea type="text" class="txtinput" cols="55" rows="20" name="content_text"><?php echo "$row[content_text]" ?></textarea></br></br>
<input type="submit" name="submit" value="Save changes">
</form>
Code for what I want to happen when the 'submit' button is pressed:
<?php
include("includes/connect.php");
if(isset($_POST['submit'])){
$order = "UPDATE content
SET content_title='$content_title', content_text='$content_text' WHERE content_page='home'";
mysql_query($order);
}
?>
The error I get:
Notice: Undefined variable: content_title in /Applications/XAMPP/xamppfiles/htdocs/templacreations/admin/admin_home.php on line 63
Notice: Undefined variable: content_text in /Applications/XAMPP/xamppfiles/htdocs/templacreations/admin/admin_home.php on line 63
Line 63 is the following line from my submit button code:
SET content_title='$content_title', content_text='$content_text' WHERE
is this not declaring them?