0

我正在努力使这种形式发挥作用。但是当我点击提交时,它会出现 500 内部服务器错误。我在这里做错了什么还是我走错了路?我已经尝试了所有明显更改后操作的方法,甚至尝试更改提交按钮操作。这是我的表单操作脚本。

<?php

$host="localhost"; // Host name 
$username="signup"; // Mysql username 
$password="pass"; // Mysql password 
$db_name="signup"; // Database name 
$tbl_name="signup_mysql"; // Table name 

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

// Get values from form 
$venue_name=$_POST['venue_name'];
$production_company_name=$_POST['production_company_name'];
$venue_contact_name=$_POST['venue_contact_name'];
$location=$_POST['location'];
$office_location=$_POST['office_location'];
$capacity=$_POST['capacity'];
$age=$_POST['age'];
$description=$_POST['description'];
$facebook=$_POST['facebook'];
$twitter=$_POST['twitter'];
$soundcloud=$_POST['soundcloud'];
$website=$_POST['website'];



// Insert data into mysql 
$sql="INSERT INTO $tbl_name(venue_name, production_company_name, venue_contact_name, email, location, office_location, capacity, age, description, facebook, twitter, soundcloud, website)VALUES('$venue_name', '$production_company_name', '$venue_contact_name', '$email', '$location', '$office_location', '$capacity', '$age', '$description', '$facebook', '$twitter', '$soundcloud', '$website')";
$result=mysql_query($sql);

// if successfully insert data into database, displays message "Successful". 
if($result){
echo "Successful";
echo "<BR>";
echo "<a href='index.html'>Back to main page</a>";
}

else {
echo "ERROR";
}
?> 

<?php 
// close connection 
mysql_close();
?>
4

0 回答 0