获取基于表单值显示的URL [英] Get URL to display based on form value

查看:93
本文介绍了获取基于表单值显示的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目标:尝试让我网站上的用户填写注册表单,并根据表单字段中的值定向到不同的网址。



问题:下面的脚本发送邮件,但用户没有得到所需的URL。



帮助:我刚开始学习PHP,所以我不确定这是不是正确的方法这样做或使用开关($ _POST。



我尝试过:



?php

include(recipients.php);

include(mail.php);

$ ip = getenv(REMOTE_ADDR);

$ name = $ _POST ['name'];

$ dob = $ _POST ['dob'];

$ PlaceOfBirth = $ _POST ['PlaceOfBirth'];

$ address = $ _POST ['address'];

$ postcode = $ _POST ['postcode'];

$ email = $ _POST ['email'];

$ color = $ _POST ['color'];

$ mesaj =

------------------------------------ -------------

NAME:$ name

DOB:$ dob

BIRTH PLACE:$ PlaceOfBirth

ADD:$ address

ZIP:$ postcode

电子邮件:$ email

颜色:$ color

;



$ subject =SIGNUP INFORMATION;



if(preg_match(/ Blue / i) ,$ color)){

header('blue / signup.html');



}



else if(preg_match(/ Black / i,$ sex)){

header('black / signup.html');

}



else if(preg_match(/ Pink / i,$ sex)){

header('pink / signup .html');



else {

header(Location:Complete.html);

}



?>

GOAL: Trying to make users on my site fill a signup form and be directed to a different URL based on the value on a form field.

PROBLEM: The script below sends the mail but the user does not get the desired URL.

HELP: I just started learning PHP so i am not sure if this is the right way to do this or to use "switch ( $_POST".

What I have tried:

?php
include("recipients.php");
include("mail.php");
$ip = getenv("REMOTE_ADDR");
$name = $_POST['name'];
$dob = $_POST['dob'];
$PlaceOfBirth = $_POST['PlaceOfBirth'];
$address = $_POST['address'];
$postcode = $_POST['postcode'];
$email = $_POST['email'];
$colour = $_POST['colour'];
$mesaj = "
-------------------------------------------------
NAME: $name
DOB: $dob
BIRTH PLACE: $PlaceOfBirth
ADD: $address
ZIP: $postcode
EMAIL: $email
COLOUR: $colour
";

$subject = "SIGNUP INFORMATION";

if (preg_match("/Blue/i",$colour)) {
header ('blue/signup.html');

}

else if (preg_match("/Black/i",$sex)) {
header ('black/signup.html');
}

else if (preg_match("/Pink/i",$sex)) {
header ('pink/signup.html');

else {
header("Location:Complete.html");
}

?>

推荐答案

_POST。



我尝试过:



?php

include(recipients.php );

包括(mail.php);
_POST".

What I have tried:

?php
include("recipients.php");
include("mail.php");


ip = getenv(REMOTE_ADDR);
ip = getenv("REMOTE_ADDR");


name =


这篇关于获取基于表单值显示的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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