在post方法上调用php [英] Call php on post method
本文介绍了在post方法上调用php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
早上好,在我的项目中,我希望使用php从mysql中获取和显示html中的数据我的html代码如下:
Good morningto all in my project i want to get and display data in html from mysql using php my html code is below
<html>
<body>
<form action="getdata.php" method="post">
Name:<input type="text" name="fname"/>
Age:<input type="text" name="age"/>
<input type="submit"/>
</form>
</body>
</html>
但上面的代码会出现以下错误
用于访问路径''/ WebSite7的HTTP谓词POST /getdata.php''是不允许的
但我在aspx页面上调用它是去aspx页面而不是去php和html页面。
我的php代码是
but the above code give the following error
The HTTP verb POST used to access path ''/WebSite7/getdata.php'' is not allowed
but i call the aspx page on action it is go to aspx page but not go to php and html page.
My php code is
<?php
$con=mysqli_connect("localhost:8080","root","","Test");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM Persons");
echo "<table border='1'>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['FirstName'] . "</td>";
echo "<td>" . $row['LastName'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>
请帮助我任何一个
谢谢和问候
By
Meganathan
Please help me any one
thanks and regards
By
Meganathan
推荐答案
con = mysqli_connect( localhost:8080,root,,Test); < span class =code-summarycomment>
// 检查 connection
if (mysqli_connect_errno())
{
echo 失败 to connect to MySQL: 。 mysqli_connect_error();
}
con=mysqli_connect("localhost:8080","root","","Test"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); }
result = mysqli_query(
result = mysqli_query(
>
con, SELECT * FROM 人员;
echo < table border =' 1' >
< tr >
< th > 名字< / th >
< th > 姓氏< / th >
< / tr > ;
while(
con,"SELECT * FROM Persons"); echo "<table border='1'> <tr> <th>Firstname</th> <th>Lastname</th> </tr>"; while(
这篇关于在post方法上调用php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文