/    Sign up×
Community /Pin to ProfileBookmark

Submit button appearing in wrong place

I’m posting this in both PHP and CSS because I don’t really know where it should go. But here’s my page where the ‘Post News’ button should appear below the table but for some reason it’s appearing above the table:
[url]http://www.jaggednighttheatre.com/admin/news.php[/url]

Here’s the code:

[CODE]
<?php
session_start();
require_once(‘../mysqli_connect.php’);
/*
if(!isset($_SESSION[‘id’]))
{
require_once(‘login_functions.inc.php’);
$url = absolute_url();
header(“Location: $url”);
exit();
}
*/
if(isset($_POST[‘submitted’]))
{
$title = mysqli_real_escape_string($dbc, trim($_POST[‘title’]));
$date = trim($_POST[‘date’]);
$body = mysqli_real_escape_string($dbc, trim($_POST[‘news’]));

$q = “INSERT INTO news (title, date, body) VALUES (‘$title’, ‘$date’, ‘$body’)”;
$r = @mysqli_query($dbc, $q);

if($r)
{
$inserted = true;
}
else
{
$error = true;
}
}
else
{
$inserted = $error = false;
}

?>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<title>Administrator Page</title>
<script type=”text/javascript” src=”ckeditor/ckeditor.js”></script>
<script type=”text/javascript” src=”recipients.js”></script>
<link href=”../style.css” rel=”stylesheet” type=”text/css” />
</head>
<body>
<div id=”wrapper”>
<div id=”title”><h1><img src=”../JNT.jpg” /></h1>
</div>

<div id=”container”>
<div id=”buttons”>
<a href=”index.php” class=”button”>Home</a>
<a href=”news.php” class=”button”><span class=”currentPage”>Update News</span></a>
<a href=”recipients.php” class=”button”>Recipients</a>
<a href=”newsletter.php” class=”button”>Send Newsletter</a>
<a href=”logout.php” class=”button”>Logout</a>
</div>
<div class=”newsletter”>
<h1>Update News</h1>
<br />
<?php
if(isset($_POST[‘newNews’]))
{
echo ‘<form action=”news.php” method=”post” class=”passwordForm”>’;
echo ‘<table class=”tableList”>’;
echo ‘<tr>’;
echo ‘<td><b>Title:</b></td>’;
echo ‘<td><input type=”text” name=”title” size=”40″ maxlength=”60″ /></td>’;
echo ‘<tr>’;
echo ‘<td><b>Date:</b></td>’;
echo ‘<td><input type=”text” name=”date” size=”10″ maxlength=”20″ /></td>’;
echo ‘</tr>’;
echo ‘</table>’;

echo ‘<script type=”text/javascript”>’;
echo ‘var dateObject = new Date();’;
echo ‘var month = dateObject.getMonth() + 1;’;
echo ‘var dateToday = dateObject.getFullYear() + “/” + month + “/” + dateObject.getDate();’;
echo ‘document.forms[0].date.value = dateToday;’;
echo ‘</script>’;
echo ‘</br>’;

echo ‘<input type=”hidden” name=”submitted” value=”TRUE” />’;
echo ‘<textarea id=”news” name=”news” rows=”20″ cols=”125″></textarea>’;

echo ‘<div class=”submit”>’;
echo ‘<input type=”submit” name=”submit” value=”Submit” />’;
echo ‘<input type=”hidden” name=”submitted” />’;
echo ‘</div>’;
echo ‘</form>’;
}
else
{
if(isset($_POST[‘submitted’]))
{
if($inserted)
{
echo “<p class=”text”><em>’$title'</em> has been inserted into the database.</p>”;
}
else if($error)
{
echo ‘<p class=”error”><em>” .$title . ”</em> could not be inserted into the database.’;
echo ‘<p class=”error”>’ . mysqli_error($dbc) . ‘</p>’;
}
}
else
{
echo ‘<div id=”table”>’;
$q = “SELECT id, title, date FROM news”;
$r = mysqli_query($dbc, $q);

$num = mysqli_num_rows($r);

if($num > 0)
{
echo ‘<table align=”center” cellspacing=”0″ cellpadding=”6″ width=”75%”>
<tr>
<td align=”left”><p><b>Edit</b></p></td>
<td align=”left”><p><b>Delete</b></p></td>
<td align=”left”><p><b>Title</b></p></td>
<td align=”left”><p><b>Date</b></p></td>
</tr>’;
}

$bg = ‘#00141c’;

while($row = mysqli_fetch_array($r, MYSQLI_ASSOC))
{
$bg = ($bg == ‘#00141c’ ? ‘#00201c’: ‘#00141c’);
$id = $row[‘id’];
echo ‘<tr bgcolor=”‘ . $bg . ‘”>

<td align=”left”><a href=”edit_user.php?id=’ . $row[‘id’] . ‘”>Edit</a></td>
<td align=”left”><a href=”news.php?delete=’ . $id . ‘” onclick=”return deleteImage(‘ . $id . ‘)”>Delete</a></td>

<td align=”left”>’ . $row[‘title’] . ‘</td>

<td align=”left”>’ . $row[‘date’] . ‘</td>

</tr>’;
}

echo ‘</div>’;
}
echo ‘<form action=”news.php” method=”post”>’;
echo ‘<div class=”postNews”>’;
echo ‘<input type=”submit” name=”submit” value=”Post News” />’;
echo ‘</div>’;
echo ‘<input type=”hidden” name=”newNews” value=”TRUE” />’;
echo ‘</form>’;
}
?>
</div>
</div>
</div>
</body>
</html>
[/CODE]

and here’s the CSS:

[CODE]
div#wrapper {
margin: 0px auto;
width: 981px;
#border: solid red 3px;
#background-color: rgb(0,20,28);
}

div#table {
width: 800px;
float: left;
padding: 0px 30px 50px 50px;
color: rgb(140,190,206);
font-family: Tahoma;
font-size: 11px;
line-height: 15px;
letter-spacing: 1.2px;
word-spacing: 2px;
margin-bottom: 20px;
}

p.text {
margin-left: 40px;
color: rgb(140,190,206);
font-family: Tahoma;
font-size: 11px;
line-height: 15px;
letter-spacing: 1.2px;
word-spacing: 2px;
margin-bottom: 20px;
}

.error{
font-weight: bold;
color: red;
}

div#title {
float: left;
width: 1000px;
height: 168px;
margin-top: 50px;
background-color: rgb(0,25,35);
}

div#container {
float: left;
width: 1000px;
_padding-bottom: 50px;
background-color: rgb(0,20,28);
}

#buttons {
background-color: rgb(0,16,22);
border-bottom: 4px solid rgb(0,24,33);
float: left;
width: 986px;
height: 30px;
color: #eaff00;
padding: 0px 7px;
margin-bottom: 30px;
font-family: Tahoma;
list-style-type: none;
display: inline;
padding-top: 10px;
}

.button{
width: 100px;
padding: 3px 30px;
color: #eaff00;
background-color: rgb(0,16,22);
font-family: Tahoma;
font-size: 14px;
text-align: center;
text-decoration: none;
padding-top: 12px;
padding-bottom: 12px;
}

a.button:hover { color: #fff;
height: 34px;
background: url(‘images/hover.png’) no-repeat center center;
}

.currentPage {color: #fff;
#background: url(‘images/hover.png’) no-repeat center center;
}

.submit {
padding-top: 10px;
text-align: center;
}

.submitForm {
float: left;
margin-left: 40px;
width: 225px;
}

.newsletter {
float: left;
margin-left: 40px;
width: 800px;
}

.passwordForm
{
color: rgb(140,190,206);
font-family: Tahoma;
font-size: 11px;
line-height: 15px;
letter-spacing: 1.2px;
word-spacing: 2px;
}

.tableList {

text-align: center;
margin: 0 auto;
}

.editTable {
text-align: center;
}
[/CODE]

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @mikeglaz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...