I’m writing a small daily devotional form for my church’s website and its works fine for the most part but there are 2 smaller issues I am having and would love some advice.
-
The the bottom table 'Devotional", i need to be a text area, but I cannot seem to make that work right. If I make it a text area it will not update it in the database when I select Edit.
-
The 2 buttons at the bottom only work separately if they are in separate forms, I am trying to place them in the same form and side by side.
here is the code:
[php]<?php
include ‘core/init.php’;
protect_page();
include ‘includes/overall/overallheader.php’;
?>
Daily Devotional
<?php $_id = (int)($_GET['id']); $_sql ="SELECT * FROM `devotional`"; $_rs = mysql_query($_sql); while($_rw = mysql_fetch_assoc($_rs)) { $_id = $_rw['id']; $_date = $_rw['date']; $_title = $_rw['title']; $_author = $_rw['author']; $_verse = $_rw['verse']; $_devotional = $_rw['devotional']; } ?> <?PHP if(isset($_POST['edit'])) { $_date = mysql_real_escape_string($_POST['_date']); $_title = mysql_real_escape_string($_POST['_title']); $_author = mysql_real_escape_string($_POST['_author']); $_verse = mysql_real_escape_string($_POST['_verse']); $_devotional = mysql_real_escape_string($_POST['_devotional']); $_id = (int)$_POST['id']; $_SQL = "UPDATE `devotional` SET `date`='$_date', `title`='$_title', `author`='$_author', `verse`='$_verse', `devotional`='$_devotional' WHERE `id`='$_id'"; mysql_query($_SQL) or die(mysql_error()); //header("Location : index.php?id=$_id"); $_html ="CLICKHERE.'; if ("default" != GetFileName($_POST['_front'])){ unlink($_POST['_front']); } if ("default" != GetFileName($_POST['_rear'])){ unlink($_POST['_rear']); } if ("default" != GetFileName($_POST['_right'])){ unlink($_POST['_right']); } if ("default" != GetFileName($_POST['_left'])){ unlink($_POST['_left']); } if ("default" != GetFileName($_POST['_intfront'])){ unlink($_POST['_intfront']); } if ("default" != GetFileName($_POST['_intrear'])){ unlink($_POST['_intrear']); } } else { $_html="
Date: |
Title: |
Author: |
verse: |
Devotional: |
"; } ?> <?php echo $_html; ?> <?php include 'includes/overall/overallfooter.php'; ?> [/php]