PHP help again! Why won't this submit?

Permabanned
Joined
22 Apr 2007
Posts
1,805
Hi guys, sorry for being a poo head.

Here is some code I've tried to generate myself

Code:
<?php 

if (!isset($_POST['submit']) || $_SERVER['REQUEST_METHOD'] != "POST")

$p_title = $_POST['title'];
$p_menu_title = $_POST['menutitle'];
$p_summary = $_POST['summary'];

$address = localhost;
$username = "mark1e_bourne";
$password = "******";
$database = "mark1e_bourne";

mysql_connect($address,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

$query = "INSERT INTO news VALUES ('$id','$p_title','$p_menu_title','$p_summary')";
mysql_query($query);

mysql_close();
?>

<html> 
<head> 
<title></title> 
</head> 
<body> 

<form action="" method="POST">

<p><label for="name">Title:</label><input type="text" id="title" name="title" /></p>

<p><label for="menutitle">Menu Title:</label><input type="text" id="menutitle" name="menutitle" /></p>

<p><label for="summary">Summary:</label><input type="text" id="summary" name="summary" /></p>


<p><input type="submit" class="button" name="submit" value="Submit Enquiry" /></p>
</form>
</body> 
</html>

Its meant to take the values from the HTML form and post them to my database.

However, when I click submit the page reloads blank and nothing gets entered into the database table 'news'.

Am I doing something wrong? (clearly)
 
Cool, thanks

Umm, I seem to be getting this now:-

Code:
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/mark1e/public_html/login/test.php on line 4

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/mark1e/public_html/login/test.php on line 4

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/mark1e/public_html/login/test.php on line 5

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/mark1e/public_html/login/test.php on line 5

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/mark1e/public_html/login/test.php on line 6

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/mark1e/public_html/login/test.php on line 6
 
Back
Top Bottom