douxi3554
2016-02-09 17:50
浏览 12
已采纳

$ _SERVER ['PHP_SELF'] -Xampp错误

<html>
<body>
<h1>NewsLetter Registration Time! </h1>
<form action='$_SERVER["PHP_SELF"]' method='post'>
Enter the username to be added:
<input type="text" id="nt1" name="username"/>
Enter the corresponding email-id to be added:
<input type="text" id="nt1" name="email_id"/>
<input type="submit"/>

<?php

if(isset($_POST['submit']))
{
    echo "<h1 style='color:red;'> Entering Data..... </h1>";
    $database=mysqli_connect('localhost','root','','userdetails')
or die("didn't work");

mysqli_query($database,"INSERT INTO userdetails (username,password)VALUES ($_POST[username],$_POST[email_id])");

mysqli_close($database);
echo "<h3 style='color:red;'> Check the database..... </h3>";
}
?>

</body>
</html>

I am not able to access Database using $_SERVER['PHP_SELF'] but the code works if I use some other php script in action. Is this a problem with xampp?

Error:enter image description here

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题