Simple Form With mailto Function

This is a discussion on Simple Form With mailto Function within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi All I have a simple form that should enable visitors to my website to send me feedback. I would ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-14-2004
george
 
Posts: n/a
Default Simple Form With mailto Function

Hi All
I have a simple form that should enable visitors to my website to send me
feedback. I would also like to have visitors redirected to certain pages of
my site depending on the success of the following - I am using something
like:
if (email_valid($from_email))
{
mail($to_my_email, $subject, $message);
// need soemthing to redirect to home page
}
else{
echo "email address invalid";
//how to redirect back to the form ??
}
Is it also possible to enable users to attach a file and include it in their
e-mail?
Any help greatly appreciated,
George


Reply With Quote
  #2 (permalink)  
Old 12-14-2004
Anthony Plunkett
 
Posts: n/a
Default Re: Simple Form With mailto Function

george wrote:
> Hi All
> I have a simple form that should enable visitors to my website to send me
> feedback. I would also like to have visitors redirected to certain pages of
> my site depending on the success of the following - I am using something
> like:
> if (email_valid($from_email))
> {
> mail($to_my_email, $subject, $message);
> // need soemthing to redirect to home page
> }
> else{
> echo "email address invalid";
> //how to redirect back to the form ??
> }
> Is it also possible to enable users to attach a file and include it in their
> e-mail?
> Any help greatly appreciated,
> George
>
>


It is usual for the user to want to know the mail was sent, so
automatically forwarding them back to index.php might not be the best
course of action, the header function will forward people to another
page if you wish (see option 1)

if(isset($_POST["submit")) {
#If the form is submitted, process it:
if(valid($from_email))
{
#Option 1: Automatically send them elsewhere:
header("Location: http://www.somewhere.com");

#Option 2: Tell them it was successful, let them click
#to go to next page (and/or use a javascript timer to # forward
them on):
include 'woohoo_email_sent.php';
}
else {
#Form failed input:
include 'error_email.php';
# (error_email will automatically show the form and fill
# it with the results it recieved from $_POST/$_GET so
# the user doesn't need to enter everything again
}
}
else {
#Show the original form, for inital input
include 'form_email.php';
}

Hope that helps,

Anthony.
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:09 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0