10-23-2011, 03:42 PM
So I'm still working on the CMS part of my project, and I'm adding a feature to where you can edit the homepage's posts.
This is what it looks like :
When I just put in.
"sdfsdfsdf"
How do I remove the array?
This is the codes :
posts.php
Update.php
Help is appreciated
This is what it looks like :
When I just put in.
"sdfsdfsdf"
How do I remove the array?
This is the codes :
posts.php
PHP Code:
<?php
require_once("auth.php");
include("stylesheet.css");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<center><b>Update Homepage Posts.</b></center>
<br>
<br>
<form method="post" action="update.php">
Homepage posts: <br />
<input type="text" name="fName" />
<input type="submit" value="Update Database" />
</form>
</body>
</html>
Update.php
PHP Code:
<?php
$fName = $_POST['fName'];
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database1", $con);
$sql="INSERT INTO news (news)
VALUES
('$_POST $fName')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
Help is appreciated