Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Goodness this is REALLY making me mad.
#1
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 :
[Image: b4cT9.png]


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 Smile
Reply
#2
What's this;
PHP Code:
('$_POST $fName')"; 
$_POST is the "Array" value, and I'm not really sure what you are trying with that query.
Reply
#3
@Above

I was being stupid, I wasn't thinking. I thought that I had to use $_POST to echo $fname Tongue

I fixed it now Big Grin
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)