如何重定向我的页面 [英] How can I redirecting my page

查看:70
本文介绍了如何重定向我的页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好。如何将联系表单页面重定向到主页?这是我的联系表格php代码。

 <?php  
include_once connect.php;

if(空($ _ POST [ inputName])||空($ _ POST [ inputMessage])){
die( 请填写此字段);
}
if(strlen($ _ POST [ inputMessage])< ; 20 || strlen($ _ POST [ inputName])< 3){
die( 请检查联系表格并再试一次);
}

$ other = ' MIME-Version:1.0' \\\\ n;
$ other 。= ' 内容类型:text / html; charset = iso-8859-9' \\\\ n;
$ name = @mysql_real_escape_string(strip_tags(trim($ _ POST [' inputName'])));
$ email = @mysql_real_escape_string(strip_tags(trim($ _ POST [' inputEmail'])));
$ subject = @mysql_real_escape_string(strip_tags(trim($ _ POST [' 子'])));
$ message = @mysql_real_escape_string(strip_tags(trim($ _ POST [' inputMessage'])));
$ who = example @ gmail。 COM;

$ content = 发件人:。$ name。 < br>电子邮件:。$ email 。 < br>主题:。$ subject。 < br>消息:。$ message;
$ other。= ' From:'。$ email;

$ send = mail($ who,$ subject,$ content,$ other);



if($ _ SERVER [ HTTP_X_REQUESTED_WITH] == XMLHttpRequest&& $ _POST){
echo 谢谢,$ name我们有你的留言,很快就会回复。;

} else {
echo 出了点问题!;
}

?>





我的尝试:



header(Location:index.php);

解决方案

_POST [ inputName])||空(


_POST [ inputMessage])){
die( 请填写此字段);
}
if(strlen(


_POST [ inputMessage])< 20 || strlen(


Hi guys. How can I redirect my contact form page to home page? This is my contact form php codes.

<?php
include_once"connect.php";

if(empty($_POST["inputName"])||empty($_POST["inputMessage"])){
	die("Please fill in this field");
	}
if(strlen($_POST["inputMessage"])<20 || strlen($_POST["inputName"])<3){
	die("Please check contact form and try again");
	}

$other = 'MIME-Version: 1.0'."\r\n";
$other .= 'Content-type: text/html; charset=iso-8859-9'."\r\n";
$name = @mysql_real_escape_string(strip_tags(trim($_POST['inputName'])));
$email = @mysql_real_escape_string(strip_tags(trim($_POST['inputEmail'])));
$subject = @mysql_real_escape_string(strip_tags(trim($_POST['sub'])));
$message = @mysql_real_escape_string(strip_tags(trim($_POST['inputMessage'])));
$who = "example@gmail.com";

$content = "Sender: ".$name."<br> Email: ".$email."<br> Subject: ".$subject."<br> Message: ".$message;
$other.= 'From: '.$email;
			
$send = mail($who,$subject,$content,$other);
	
   
	
	if($_SERVER["HTTP_X_REQUESTED_WITH"] == "XMLHttpRequest" && $_POST){
	echo "Thanks, $name we have your message and will reply soon.";
	
	}else{
		echo "Something is wrong!";
		}
	
?>                  



What I have tried:

header("Location: index.php");

解决方案

_POST["inputName"])||empty(


_POST["inputMessage"])){ die("Please fill in this field"); } if(strlen(


_POST["inputMessage"])<20 || strlen(


这篇关于如何重定向我的页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆