Well, I've started on my portfolio script. So far, so good. I've run in to three errors so far:
1. Name doesn't appear when adding news
2. Unexpected "t" after the date
3. After the PHP there is a bottom DIV, which doesn't display
Here's my code:
Moved by Agesilaus (Forum Moderator) from Design and Development: Please post in the correct forum next time.PHP Code:<?php
// Database
include "config.php";
//Variables
$title = ($_POST["title"]);
$news = ($_POST["news"]);
$date = date('F dS h:i: ');
// Some mySQL to fetch your name
$sql = "SELECT * FROM details";
$check = mysql_query("SELECT name FROM details") or die("Onoes! Something is wrong! Please contact loserWILL for assistance (this is an error).");
while ($display = mysql_fetch_array($check)) {
$user = $display['user'];
// If form has been submitted, display this
if ($_GET["action"] == "submit")
{
if ($title == "")
{
echo "Onoes! Please enter a title.";
exit;
}
if ($news == "")
{
echo "Onoes! Please enter some news.";
exit;
}
$addnews = mysql_query("INSERT INTO `news` (`title`, `name`, `date`, `post`) VALUES ('$title','$name','$date', '$post')");
//Details are fine
echo "Your news has been added.";
exit;
}
// Display form
echo ("<form action=\"?action=submit\" method=\"post\">
<strong>Name:</strong> $user<br />
<strong>Title:</strong> <input type=\"text\" name=\"title\"><br />
<strong>News:</strong> <input type=\"text\" name=\"news\"><br />
<input type=\"submit\" name=\"submit\" value=\"Add News\">
</form>");
exit;
}![]()







Reply With Quote


