/    Sign up×
Community /Pin to ProfileBookmark

Forms – GET vers POST

I have forms on my site which result in e-mails being sent to me with the information provided by the viewer.

I want to create forms which will create a page on the viewers screen which he can then print.

I have been reading as much as I can (time permitting) and am beginning to realize the the GET vers the POST command has something to do with what I want.

I have a file named “mailer.php” which results in the form being sent to me – it uses the POST command. Is there such a file which would result in the viewer receiving a new page using the information he/she typed into the form???

Sorry if this sounds very basic but so far I haven’t managed to figure out a solution to my problem although I know it can be done.

Added: I have just been reading something that makes me wonder if the command I am looking for might not be ECHO. Having read this, if you get the idea that I’m confused and a beginner – bingo, you got it one but all help will be appreciated.

Cheers and thanks in advance

Jack

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@ronverdonkAug 28.2006 — Maybe it is better if you first learn the PHP basics of passing data between pages using the $_POST and $_GET global arrays.

I advise you to have a look at some tutorials, such as:

[URL=http://www.w3schools.com/default.asp]http://www.w3schools.com/default.asp[/URL]

[URL=http://www.allsyntax.com/tutorials/PHP/]http://www.allsyntax.com/tutorials/PHP/[/URL]

and of course there is always:

[URL=www.php.net]www.php.net[/URL]


Ronald ?
Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYAug 28.2006 — yes echo will print out text to screen

post that mailer.php code (don't forget to remove your e-mail address from the script)
Copy linkTweet thisAlerts:
@The_MagusauthorAug 28.2006 — The code is as follow:


[code=php]<?PHP

#######################################################
# This script is Copyright 2003, Infinity Web Design #
# Distributed by http://www.webdevfaqs.com #
# Written by Ryan Brill - [email][email protected][/email] #
# All Rights Reserved - Do not remove this notice #
#######################################################

## The lines below need to be edited...

###################### Set up the following variables ######################
#
$to = "[email protected]"; #set address to send form to
$subject = "Results from your Request Info form"; #set the subject line
$headers = "From: [email][email protected][/email]"; #set the from address, or any other headers
$forward = 1; # redirect? 1 : yes || 0 : no
$location = "Thank_you.htm"; #set page to redirect to, if 1 is above
#
##################### No need to edit below this line ######################

## set up the time ##

$date = date ("l, F jS, Y");
$time = date ("h:i A");

## mail the message ##

$msg = "Below is the result of your feedback form. It was submitted on $date at $time.nn";

if ($_SERVER['REQUEST_METHOD'] == "POST") {
foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "n";
}
}
else {
foreach ($_GET as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "n";
}
}

mail($to, $subject, $msg, $headers);
if ($forward == 1) {
header ("Location:$location");
}
else {
echo "Thank you for submitting our form. We will get back to you as soon as possible.";
}

?>[/code]


Thanks for your interest.

Jack
×

Success!

Help @The_Magus 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.25,
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,
)...