yo!
Thanks to help from this very site, I have the following code
directly above my HTML form
When I click update, the information is submitted accurately, but also, another entry is made which is completely blank.
Why is this? What do I need to add to the code to stop this happening?
The part at the top:-
is used because this is the first page presented after a successful login.
Any help, as always, greatly appreciated.
Thanks
Thanks to help from this very site, I have the following code
Code:
<?php
session_start();
if(!$_SESSION['username']) {
//not logged in. redirect to login page
header("Location: login.php");
exit;
}
$p_title = $_POST['title'];
$p_menu_title = $_POST['menutitle'];
$p_summary = $_POST['summary'];
$p_body = $_POST['body'];
$address = "localhost";
$username = "mark1e_bourne";
$password = "you_wish";
$database = "mark1e_bourne";
mysql_connect($address,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "INSERT INTO news (p_title, p_menu_title, p_summary, p_body) VALUES ('$p_title','$p_menu_title','$p_summary','$p_body')";
mysql_query($query);
mysql_close();
?>
directly above my HTML form
When I click update, the information is submitted accurately, but also, another entry is made which is completely blank.
Why is this? What do I need to add to the code to stop this happening?
The part at the top:-
Code:
]<?php
session_start();
if(!$_SESSION['username']) {
//not logged in. redirect to login page
header("Location: login.php");
exit;
}
Any help, as always, greatly appreciated.
Thanks