10 to 20 User Inputs to Process in PHP
Moderator: General Moderators
10 to 20 User Inputs to Process in PHP
I just put my step in PHP.I aim to master it very soon and help others freely.I searched for a Guide to teach me.I bought a book,but the Form Processing Chapters are very limited.So I came here.
My Question: How to process 10 to 20 User inputs(HTML Form inputs) in PHP to send email.(10-20 User Inputs to My Email)
For eg.
Name:
Email:
Tel:
Address1:
Address2:
etc
Pls guide me.I only get free Feedback form for free.I want to add more to it.
My Question: How to process 10 to 20 User inputs(HTML Form inputs) in PHP to send email.(10-20 User Inputs to My Email)
For eg.
Name:
Email:
Tel:
Address1:
Address2:
etc
Pls guide me.I only get free Feedback form for free.I want to add more to it.
Re: 10 to 20 User Inputs to Process in PHP
Step 1: create HTML Form
Step 2: Create PHP page to process form. Use either $_POST or $_GET to retrieve the values of the form.
Step 3: Use PHP's native mail() function to send the email.
Step 2: Create PHP page to process form. Use either $_POST or $_GET to retrieve the values of the form.
Step 3: Use PHP's native mail() function to send the email.
Re: 10 to 20 User Inputs to Process in PHP
With examples of my user inputs please.
Re: 10 to 20 User Inputs to Process in PHP
If you are looking for the code I would suggest searching for a tutorial. I tried "php mail form tutorial" and got plenty.
This one seemed very simple and would include the framework to get you going:
http://www.kirupa.com/forum/showthread.php?t=17313
The tutorial is self posting but I would adapt it like hawleyjr said to go from the form page to a process page.
This one seemed very simple and would include the framework to get you going:
http://www.kirupa.com/forum/showthread.php?t=17313
The tutorial is self posting but I would adapt it like hawleyjr said to go from the form page to a process page.
Re: 10 to 20 User Inputs to Process in PHP
Thanks Kirupa.com.
Can you suggest me of a Secure PHP to email Hot Script that is compitabble with Php v.5.2.3.
Can you suggest me of a Secure PHP to email Hot Script that is compitabble with Php v.5.2.3.
Re: 10 to 20 User Inputs to Process in PHP
It did not work,a little guidance please.Write here by changing the codes below-
Can any one make the following a valid php5 form processing:-
<?php
$_POST['fullname']
$_POST['email']
$_POST['telephone']
$_POST['mobile']
$_POST['plan']
$_POST['agreement'] // user input will be yes or no
$to = $_POST[email];
$sublect = "We'll reply very soon";
$msg = "Dear: " . $_POST[fullname] . " " $_POST[email] . ",\n\n";
$msg .= "We have received details from you."
$mailheaders = "From: Registration Page <aaaa@ppp.com>;
$mailheaders .= "Reply - To: dddd@eee.com";
mail($to, $subject, $msg, $mailheaders);
?>
Can any one make the following a valid php5 form processing:-
<?php
$_POST['fullname']
$_POST['email']
$_POST['telephone']
$_POST['mobile']
$_POST['plan']
$_POST['agreement'] // user input will be yes or no
$to = $_POST[email];
$sublect = "We'll reply very soon";
$msg = "Dear: " . $_POST[fullname] . " " $_POST[email] . ",\n\n";
$msg .= "We have received details from you."
$mailheaders = "From: Registration Page <aaaa@ppp.com>;
$mailheaders .= "Reply - To: dddd@eee.com";
mail($to, $subject, $msg, $mailheaders);
?>
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: 10 to 20 User Inputs to Process in PHP
Code: Select all
$msg .= "We have received details from you."Try putting error_reporting(E_ALL); at the top of your script and see the magic happen
However, I would have to kindly ask you to stop asking people to do the work for you. This includes PM's.
Re: 10 to 20 User Inputs to Process in PHP
See there is Parse error: syntax error,
unexpected T_STRING in /nnnn/hhhh/public_html/present.php
on line 9 (which is underlined).
Any other errors and Security issue?
<?php
$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
$name = $_POST['name'] ;
$email = $_POST['email'] ;
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );
if (!isset($_POST['email']))
{ header( "Location: $formurl="http://www.pppp.com/form5.html" ); exit ;
}
if (empty($name) || empty($email) || empty($comments)) { header(
"Location: $errorurl="http://www.pppp.com/error.html" ); exit ;
}
if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) { header(
"Location: $errorurl="http://www.pppp.com/error.html" ); exit ;
}
if (get_magic_quotes_gpc()) { $comments = stripslashes( $comments );
}
$messageproper = "This message was sent from:\n" . "$http_referrer\n" .
"------------------------------------------------------------\n" .
"Name of sender: $name\n" . "Email of sender: $email\n" .
"------------------------- COMMENTS -------------------------\n\n" .
$comments .
"\n\n------------------------------------------------------------\n" ;
mail($mailto='bikri@pppp.com', $subject="Feedback Form", $messageproper, "From: \"$name\"
<$email>" . $headersep . "Reply-To: \"$name\" <$email>" .
$headersep . "X-Mailer:php 5.2.3" );
header( "Location: $thankyouurl="http://www.pppp.com/success.html" );
exit ;
?>
unexpected T_STRING in /nnnn/hhhh/public_html/present.php
on line 9 (which is underlined).
Any other errors and Security issue?
<?php
$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
$name = $_POST['name'] ;
$email = $_POST['email'] ;
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );
if (!isset($_POST['email']))
{ header( "Location: $formurl="http://www.pppp.com/form5.html" ); exit ;
}
if (empty($name) || empty($email) || empty($comments)) { header(
"Location: $errorurl="http://www.pppp.com/error.html" ); exit ;
}
if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) { header(
"Location: $errorurl="http://www.pppp.com/error.html" ); exit ;
}
if (get_magic_quotes_gpc()) { $comments = stripslashes( $comments );
}
$messageproper = "This message was sent from:\n" . "$http_referrer\n" .
"------------------------------------------------------------\n" .
"Name of sender: $name\n" . "Email of sender: $email\n" .
"------------------------- COMMENTS -------------------------\n\n" .
$comments .
"\n\n------------------------------------------------------------\n" ;
mail($mailto='bikri@pppp.com', $subject="Feedback Form", $messageproper, "From: \"$name\"
<$email>" . $headersep . "Reply-To: \"$name\" <$email>" .
$headersep . "X-Mailer:php 5.2.3" );
header( "Location: $thankyouurl="http://www.pppp.com/success.html" );
exit ;
?>
- EverLearning
- Forum Contributor
- Posts: 282
- Joined: Sat Feb 23, 2008 3:49 am
- Location: Niš, Serbia
Re: 10 to 20 User Inputs to Process in PHP
Code: Select all
$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
$name = $_POST['name'] ;
$email = $_POST['email'] ;
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );
if (!isset($_POST['email']))
{ header( "Location: $formurl="http://www.pppp.com/form5.html" ); exit ;
}
if (empty($name) || empty($email) || empty($comments)) { header(
"Location: $errorurl="http://www.pppp.com/error.html" ); exit ;
}
if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) { header(
"Location: $errorurl="http://www.pppp.com/error.html" ); exit ;
}
if (get_magic_quotes_gpc()) { $comments = stripslashes( $comments );
}
$messageproper = "This message was sent from:\n" . "$http_referrer\n" .
"------------------------------------------------------------\n" .
"Name of sender: $name\n" . "Email of sender: $email\n" .
"------------------------- COMMENTS -------------------------\n\n" .
$comments .
"\n\n------------------------------------------------------------\n" ;
mail($mailto='bikri@pppp.com', $subject="Feedback Form", $messageproper, "From: \"$name\"
<$email>" . $headersep . "Reply-To: \"$name\" <$email>" .
$headersep . "X-Mailer:php 5.2.3" );
header( "Location: $thankyouurl="http://www.pppp.com/success.html" );
exit ;Which is, in case you still don't see it, in your header() arguments.
So ...
1. If you're going to use double quotes (") in a string that is double quoted you have to escape them (\"), or simpler, use single quotes('). That unexpected string error happened because PHP parser encountered http://www.pppp.com/form5.html after the end of the string.
2. You can't define variables in strings like you tried.
Code: Select all
header( "Location: $formurl="http://www.pppp.com/form5.html" ); exit ;Code: Select all
$formurl="http://www.pppp.com/form5.html";
header( "Location: $formurl" );
exit;