well ive been trying to make a admin panel where i can change the text on the homepage if you are logged in.
here is my funtion for adding to the database:
Code:
function addtext(){
global $session, $database, $form;
$q = "INSERT INTO content (text) VALUES ('$_POST[$content]')";
$database->query($q);
}
And here is the code for the form:
Code:
<form action="adminprocess.php" method="post">
content: <input type="text" name="content"/>
<input type="submit" value="add content"/>
</form>
When i put a value into the form and click submit it takes me to admin process.php. and adds a blank entry to the database. No matter what i put into the form it always makes a blank entry.
I tried changing it to just add a set peice of text:
Code:
$q = "INSERT INTO content (text) VALUES ('hello world')";
This works fine and adds hello world to the database.
My database name is 'adminp', my table name is 'content' and my feild is 'text'.
Any help with this would be greatly appreciated.
|