这个问题在这里已经有答案了:
为什么我不应该在php中使用mysql函数(12个答案)
两年前关门了。
php mysql\u connect(“localhost”,“root”,“”)或die(mysql\u error());mysql\u select\u db(“shehan”)或die(mysql\u error());
if(isset($_POST['submit']))
{
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$date = date('Y-m-d');
$b_t = $_POST['b_t'];
$country = $_POST['country'];
$company = $_POST['company'];
$message = $_POST['message'];
$to = "mo19867@eastwest.edu";
$message1 = "
$name:
Thanks for contacting.we recieve Your Message and will contact you asap.
Country: $country
Company: $company
Phone No: $phone
Email ID: $email
Message: $message
Paid Date: $date";
mysql_query("insert into contactus(name,email,phone,business,country,company,message) values('$name','$email','$phone','$b_t','$country','$company','$message')")or die(mysql_error());
mail("$to","www.shehangems.com",$message1);
echo "<script>alert('You have successfully submitted your data.');
window.location.href='contact.html'
</script>";
1条答案
按热度按时间tvz2xvvm1#
你用的是古老的
mysql_
功能。这些不再是php的一部分。我建议你换成pdo。
在这里看到一个出色的入门pdohttps://phpdelusions.net/pdo
当然,还有医生http://php.net/manual/en/class.pdo.php
有些人会建议你改用
mysqli
. 先看看这个再考虑那个。https://phpdelusions.net/pdo/mysqli_comparison