n00b question ?!

I also get the folloowing error when I press the submit button

You don't have permission to access /<br /><b>Notice</b>: Undefined variable: PHP_SELF in <b>c:/program files/apache group/apache/htdocs/form_demande_action2.php</b> on line <b>27</b><br /> on this server.

But i should have permission since i can successfully read from the database through a similar connection.
 
Use this code, it works:

Code:
<html> 
<body>
<?php 
if ($HTTP_POST_VARS["submit"]) { // LINE 16 
	$db = mysql_connect("localhost", "e_volution", "e_volution"); 
	mysql_select_db("mydb",$db); 
	$sql = "INSERT INTO demande_action (field1,field2,field3) VALUES (".$HTTP_POST_VARS["name"].",".$HTTP_POST_VARS["email"].",".$HTTP_POST_VARS["website"].")"; 
	$result = mysql_query($sql); 
	echo "Your data has been added to the database: NAME: ".$HTTP_POST_VARS["name"].", EMAIL: ".$HTTP_POST_VARS["email"].", WEBSITE: ".$HTTP_POST_VARS["website"]."";
}else{
?> 
	<form method="post" action="<?php $PHP_SELF ?>"> 
	<p>
	Write your name:<br>
	<input type="text" name="name"> <br>
	Write your email:<br>
	<input type="text" name="email"> <br>
	Write your website:<br>
	<input type="text" name="website"> <br>
	<input type="Submit" name="submit" value="insert into database!"> <br>
	</form> 
<?php
}//end of else
?>
</body> 
</html>
I hope it helped!
 
Back
Top