Hi, im currently designing a form on dreamweaver and it allows a client to enter their Name, Email and Comments. At the same time i want this data to store in my mysql database which i created.
The php code that i used is shown below, but the problem is that when i press on submit on my form it doesnt not go to my mysql database and instead downloads a file of my php codes.
Does anyone have a solution to this? Thank you
<?php
$u="root";
$db="cascadeglobal";
$Name=$_POST['Name'];
$Email=$_POST['Email'];
$Comments=$_POST['Comments'];
mysql_connect(localhost,$u);
@mysql_select_db($db)or die("failed to connect the database");
$insert="insert into Comments(Name,Email,Comments)values('$Name','$Email','$Comments')";
if(mysql_query($insert))
{
echo('records have been updated');
}
else
{
echo("records failed to be updated").mysql_error();
}
?>