我是靠谱客的博主 刻苦绿茶,最近开发中收集的这篇文章主要介绍php表单登录跳转页面跳转页面,表单提交后,PHP重定向到另一个页面,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

我已经阅读了所有有关将标头插入php表单文件中以便在提交表单后将用户重定向到另一个URL的文章-但我不知道该怎么做。下面是我的代码。您能告诉我在哪里放置标题/重定向,以便通过电子邮件发送信息,然后用户转到另一个html页面吗?

if(isset($_POST['email'])) {

// EDIT THE 2 LINES BELOW AS REQUIRED

$email_to = "pecraig@moneymovers.com";

$email_subject = "Mailing List Form";

function died($error) {

// your error code can go here

echo "We are very sorry, but there were error(s) found with the form you

submitted. ";

echo "These errors appear below.
";

echo $error."
";

echo "Please go back and fix these errors.
";

die();

}

// validation expected data exists

if(!isset($_POST['first_name']) ||

!isset($_POST['last_name']) ||

!isset($_POST['email']) ||

!isset($_POST['telephone']) ||

!isset($_POST['company']) ||

!isset($_POST['street']) ||

!isset($_POST['city']) ||

!isset($_POST['state']) ||

!isset($_POST['zip'])) {

died('We are sorry, but there appears to be a problem with the form you

submitted.');

}

$first_name = $_POST['first_name']; // required

$last_name = $_POST['last_name']; // required

$email_from = $_POST['email']; // required

$telephone = $_POST['telephone']; // required

$company = $_POST['company']; // required

$street = $_POST['street']; // required

$city = $_POST['city']; // required

$state = $_POST['state']; // required

$zip = $_POST['zip']; // required

$error_message = "";

$string_exp = "/^[A-Za-z0-9 .'-]+$/";

if(!preg_match($string_exp,$first_name)) {

$error_message .= 'The First Name you entered does not appear to be valid.
';

}

if(!preg_match($string_exp,$last_name)) {

$error_message .= 'The Last Name you entered does not appear to be valid.
';

}

$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,4}$/';

}

?>

最后

以上就是刻苦绿茶为你收集整理的php表单登录跳转页面跳转页面,表单提交后,PHP重定向到另一个页面的全部内容,希望文章能够帮你解决php表单登录跳转页面跳转页面,表单提交后,PHP重定向到另一个页面所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(60)

评论列表共有 0 条评论

立即
投稿
返回
顶部