iamelectro
New Member
Greetings I made the following php script so that I could edit text and it would save to a db for future use. However I'm hitting a slight snag at the update / insert queries. I'm not sure what I'm doing wrong but only one of the commands will execute. I'm not sure if this is a hosting issue or am I doing something wrong. Any ideas?\[code\]if(isset($_SESSION["logged"]) && $_SESSION["logged"]==1){ if($_POST['action']=="edit"){ $query=mysql_query("select * from page where active=1 AND heading='".$_POST['selectedpage']."'"); $row = mysql_fetch_array($query, MYSQL_ASSOC); echo "<h1>HTML Editor </h1><br>"; echo "<form name='saveform' action='./action.php' method='post'>"; echo "<textarea rows='100' cols='100' name='updateBox'>".$row['content']."</textarea>"; echo "<br><input name='action' type='submit' value='http://stackoverflow.com/questions/2097728/save edit'>"; echo "<input name='heading' type='hidden' value='".$row['heading']."'>"; echo "</form>";}else if($_POST['action']=="save edit"){ $query=mysql_query("UPDATE page SET active='0' where heading='".$_POST['heading']."'"); $query=mysql_query("INSERT into page(heading,content,active) values('".$_POST['heading']."','".$_POST['updateBox']."','1')"); echo "<p>Changes saved succesfully!</p>"; echo "$_POST['updateBox']}\[/code\]