/    Sign up×
Community /Pin to ProfileBookmark

need help all purpose mail form handler

I am looking to make an all purpose mail handler so you just have to make th e form and send it to the mailform.php file

I don’t know enough to handle the entire process, far from it.

This is what I was thinking to start.

[code=php]<?php

$sendto = “[email protected]”;
$request_method = $_SERVER[“REQUEST_METHOD”];
if($request_method == “GET”){
$query_vars = $_GET;
} elseif ($request_method == “POST”){
$query_vars = $_POST;
}
reset($query_vars);
$t = date(“U”);

// This is the part I don’t know how to write,
// I want you to put any fields in the form and this section
// will take all those fields and turn them into strings
// and then submit the form as a get or a post to the address
// above in the $sendto

while (list ($key, $val) = each ($query_vars)) {
// something to handle all the form values and names in to $key or something;

// then continue with
if ($key == “redirect”) { $landing_page = $val;}
}

if ($landing_page != “”){
header(“Location: http://”.$_SERVER[“HTTP_HOST”].”/$landing_page”);
} else {
header(“Location: http://”.$_SERVER[“HTTP_HOST”].”/”);
}
?> [/code]

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @galgoz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...