Php 在我的注册申请中我出了什么问题
我正在写一个web注册表单和相关的php 我已经在我的计算机上安装了Xampp。。 我写了Php 在我的注册申请中我出了什么问题,php,html,Php,Html,我正在写一个web注册表单和相关的php 我已经在我的计算机上安装了Xampp。。 我写了newindex.php如下 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Title of the document</title> </head> <body> <form action="signup.php"
newindex.php
如下
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title of the document</title>
</head>
<body>
<form action="signup.php" method="post" >
<input type="text" name="first" placeholder="Firstname"><br>
<input type="text" name="last" placeholder="Lastname"><br>
<input type="text" name="uid" placeholder="Usernmae"><br>
<input type="password" name="pwd" placeholder="Password"><br>
<button type="submit">Sign Up</button>
</form>
</body>
</html>
当我运行时,我会在浏览器上看到以下内容
哪个是错误的
-----电流输出-------------
上面的输出是错误的,应该是用户插入到我之前创建的表单中时的值
我怎样才能解决这个问题
欢迎任何帮助
我错在哪里
那么,我的扩展是否正确,PHP安装中是否存在问题?您的脚本必须位于xampp的htdocs文件夹中 如果以标准安装,则可以在路径中复制这两个文件 例如 C:\ProgramFiles(x86)\xampp\htdocs 如果键入浏览器URL,则可以访问这些文件: 例如
否则,如果您以
file:///c:/whatever
当您通过直接打开php文件绕过服务器时,不会执行php代码
您必须使用
http://localhost/newindex.php
。这样,apache将处理请求并在发送响应之前执行php代码。我已经做了必要的更改。请尝试下面的代码,并通知我,如果您将面临任何错误
HTML代码:-
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title of the document</title>
</head>
<body>
<form action="signup.php" method="post">
<input type="text" name="first" placeholder="Firstname"><br>
<input type="text" name="last" placeholder="Lastname"><br>
<input type="text" name="uid" placeholder="Usernmae"><br>
<input type="password" name="pwd" placeholder="Password"><br>
<input type="submit" name="submit" value="Sign Up">
</form>
</body>
</html>
文件标题
signup.php:-
<?php
if(isset($_POST['submit']))
{
echo $_POST['first']."<br>";
echo $_POST['last']."<br>";
echo $_POST['uid']."<br>";
echo $_POST['pwd'];
}
?>
如何在浏览器上运行脚本。在URL中使用localhost执行,如下所示file:///C:/xampp/htdocs/newindex.php @您的apache Web服务正在运行吗?然后,通过指向应用程序路径的url,它正在运行……控制面板显示mysql和apache正在运行……@NTALOVENTI将其更改为localhost/newindex.php。当您执行php文件时,请确保您的xampp已打开且apache服务正在运行,并且url必须是htdocsit中的localhost/ur路径在C:\xampp\htdocs\newindex.phpgot it中可用。。。。。。。。。。。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title of the document</title>
</head>
<body>
<form action="signup.php" method="post">
<input type="text" name="first" placeholder="Firstname"><br>
<input type="text" name="last" placeholder="Lastname"><br>
<input type="text" name="uid" placeholder="Usernmae"><br>
<input type="password" name="pwd" placeholder="Password"><br>
<input type="submit" name="submit" value="Sign Up">
</form>
</body>
</html>
<?php
if(isset($_POST['submit']))
{
echo $_POST['first']."<br>";
echo $_POST['last']."<br>";
echo $_POST['uid']."<br>";
echo $_POST['pwd'];
}
?>