Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使我的简单php表单进入html页面?_Php_Html_Forms - Fatal编程技术网

如何使我的简单php表单进入html页面?

如何使我的简单php表单进入html页面?,php,html,forms,Php,Html,Forms,我已经创建了一个简单的PHP代码,我希望它重定向到我的HTML页面,但我不知道如何做到这一点?有什么帮助吗?(顺便说一句,我不使用MySQL) 我只是想把它重定向到我创建的另一个页面,但我看了教程,没有一个有用 有人有我可以使用的简单代码吗???您好,您可以使用它: <!DOCTYPE html> <html> <head> <title>Redirect Form To a Particular Page On Submit - Demo Pre

我已经创建了一个简单的PHP代码,我希望它重定向到我的HTML页面,但我不知道如何做到这一点?有什么帮助吗?(顺便说一句,我不使用MySQL)

我只是想把它重定向到我创建的另一个页面,但我看了教程,没有一个有用

有人有我可以使用的简单代码吗???

您好,您可以使用它:

<!DOCTYPE html>
<html>
<head>
<title>Redirect Form To a Particular Page On Submit - Demo Preview</title>
<meta content="noindex, nofollow" name="robots">
<link href='css/redirect_form.css' rel='stylesheet' type='text/css'> <!--== Include CSS File Here ==-->
</head>
<body>
<div class="main">
<div class="first">
<h2>Redirect Form To a Particular Page On Submit using PHP</h2>
<form action="redirect_form.php" id="#form" method="post" name="#form">
<label>Name :</label>
<input id="name" name="name" placeholder='Your Name' type='text'>
<label>Email :</label>
<input id="email" name="email" placeholder='Valid Email Address' type='text'>
<label>Contact :</label>
<input id="contact" name="contact" placeholder='Contact' type='text'>
<label>Address:</label>
<input id="address" name="address" placeholder='Address' type='text' value="">
<input id='btn' name="submit" type='submit' value='Submit'>
<!---- Including PHP File Here ---->
<?php
include "include/redirect.php";
?>
</form>
</div>
</div>
</body>
</html>

在提交-演示预览时将表单重定向到特定页面
使用PHP将表单重定向到提交时的特定页面
姓名:
电邮:
联系人:
地址:
在提交表单的php中使用它:

<?php
if(isset($_POST['submit'])){
// Fetching variables of the form which travels in URL
$name = $_POST['name'];
$email = $_POST['email'];
$contact = $_POST['contact'];
$address = $_POST['address'];
if($name !=''&& $email !=''&& $contact !=''&& $address !='')
{
//  To redirect form on a particular page
header("Location:https://www.formget.com/app/");
}
else{
?><span><?php echo "Please fill all fields.....!!!!!!!!!!!!";?></span> <?php
}
}
?>

记住,这只是一个例子。header函数有助于在php中重定向。
检查此链接:

试试我的代码很简单,首先创建名为index.php的文件 然后大声说出密码

<?php
if(isset($_GET["button"])){
    header("Location:redirect.html");
}
?>
<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
<form method="GET">
    <button type="submit" name="button">Click to redirect!</button> 
</form>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
    <title>Redirected</title>
</head>
<body>
<h1>Your page finish to redirect ^_^</h1>
</body>
</html>

点击重定向!
然后创建名为redirect.html的文件 暗中

<?php
if(isset($_GET["button"])){
    header("Location:redirect.html");
}
?>
<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
<form method="GET">
    <button type="submit" name="button">Click to redirect!</button> 
</form>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
    <title>Redirected</title>
</head>
<body>
<h1>Your page finish to redirect ^_^</h1>
</body>
</html>

重定向
您的页面将完成重定向^_^
在浏览器中打开index.php

之后产生像这样的图像


然后只需单击按钮,您将被重定向。

欢迎使用Stack Overflow u请将您尝试的代码添加到您的帖子中。这将使SO贡献者更容易帮助您。请访问SO帮助中心和关于添加“最小、可复制示例”的指南>>