+ Post New Thread
Results 1 to 3 of 3
Web Development Thread, Webform reply to address in Coding and Web Development; Hello, I have created a web form to allow parents and other visitors to the site to send a message ...
  1. #1

    Join Date
    May 2006
    Location
    West Bromwich
    Posts
    2,190
    Thank Post
    299
    Thanked 215 Times in 185 Posts
    Rep Power
    56

    Webform reply to address

    Hello,

    I have created a web form to allow parents and other visitors to the site to send a message to the secretary. At the moment all is working fine except one thing.

    I have set up a box for email address which should then be provided as the return address. But this is not the case. Since the php mail function is running on the webserver and the server is also the smtp sender then the reply address is set as the servers address.

    how can i set the reply address to the senders address that they put in the box.

    I have sent the form using the post method into a .php page which then sends the info and echo a success message or failure message to screen.

    The email field has the label of contact_email and the name is Email.

    There is a javascript variable set by the contents of this field which is used for validation.

    I have a variable set on the php side $email = $-REQUEST['email']; which is used in the send command. I have tried to use the same variable in the headers reply to section but this does not work.
    what can i do to try and resolve this problem?

  2. #2

    Edu-IT's Avatar
    Join Date
    Nov 2007
    Posts
    7,114
    Thank Post
    403
    Thanked 619 Times in 566 Posts
    Rep Power
    180

    Re: Webform reply to address

    I use the following code for my contact form. When I receive an email the from address is the email address that the person specified when completing the form. I am not a PHP developer so I can't help you much but you might be able to work it out from my code.

    PHP Code:
    <? 
        
    if($_POST['submit']){
        
          
    $name $_REQUEST['name'] ; 
          
    $email $_REQUEST['email'] ; 
          
    $message $_REQUEST['message'] ; 
        
          if(
    $name == '' || $email == '' || $message == ''){
            
    $comment 'All of the fields need to be completed!';
          }
          elseif(!
    eregi("^[0-9a-z]([-_.~]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,4}$",$email)){
            
    $comment 'The e-mail address you have entered is invalid!';
          }
          else
          {
                  
    mail"Email address""Subject"$message"From: $email); 
              
    header"Location: ?sent=yes" ); 
          }
        }
    ?>

  3. #3

    Join Date
    May 2006
    Location
    West Bromwich
    Posts
    2,190
    Thank Post
    299
    Thanked 215 Times in 185 Posts
    Rep Power
    56

    Re: Webform reply to address

    Yes thats right. The email address the users enters is the one that will be replied to.

    I will give it a go.

    Cheers

SHARE:
+ Post New Thread

Similar Threads

  1. MSN, E-mail address
    By FN-GM in forum General Chat
    Replies: 72
    Last Post: 20th June 2007, 07:53 AM
  2. PHP, MySQL, Webform, idiots guide.
    By Quackers in forum Coding
    Replies: 2
    Last Post: 5th June 2007, 08:03 AM
  3. Topic Reply Notification
    By witch in forum Comments and Suggestions
    Replies: 0
    Last Post: 27th April 2007, 09:44 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •