Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6

Thread: mail form help

  1. #1
    Senior Member Karloff's Avatar
    Join Date
    Oct 2005
    Posts
    744
    Member #
    11702
    decided to change the form that i was using so it valditated a bit and there is some sort of problem. what is wrong here?
    Last edited by Karloff; Sep 12th, 2013 at 12:28 PM.

  2.  

  3. #2
    Senior Member Karloff's Avatar
    Join Date
    Oct 2005
    Posts
    744
    Member #
    11702
    got it working, added in the location wrong at the top. but it still isn't sending or validating it or using the echo messages i want?
    PHP Code:
    <?php
        

      $email 
    $_REQUEST['email'] ;
      
    $message $_REQUEST['message'] ;
      
    $name $_REQUEST['name'];
      
    $telephone $_REQUEST['telephone'];
      
    $subject $_REQUEST['subject'];
      
      if (!isset(
    $_REQUEST['email'])) {
        
    header"Location: http://www.sandstone.com/contact.php" );
      }
      elseif (empty(
    $email) || empty($message) || empty($name) || empty($telephone) || empty($subject)) {
            echo 
    'There was an error while sending the mail.';
        
    header"Location: http://www.sandstone.com/contact.php" );
      }
      else {
        
    mail('yolday@paulcurley.com'$subject$message"From: $from\r\nReply-To: $from\r\n");
          echo 
    'Your mail was successfully sent.';
        
    header"Location: http://www.sandstone.com/contact.php" );
      }
    ?>
    Last edited by Karloff; Sep 12th, 2013 at 12:28 PM.

  4. #3
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    I could swear there's some function to reduce those five lines of variable assignments into a single line--assign the values of the array to their respective keys as separate variables--but I can't find it.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  5. #4
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,715
    Member #
    5580
    Liked
    717 times
    Here's your problem:

    Your HTML form has this line:
    <input type="text" name="from" size="40" class="submit"/>

    You are looking for this variable in your script:
    $email = $_REQUEST['email'] ;


    Decide which one to use and make them the same.


    EDIT:

    A couple of security issues:

    1) Don't let the user enter the subject line.
    Hard-code your subject in your script and put the user's subject
    line in with the message.

    2) Don't use $_REQUEST ... that opens all incoming variables (possible problems).
    On your form use <form .... method="post" ....>
    Then, use $_POST['whatever'] instead of $_REQUEST['whatever'];

    .... or if Fiburt can find what he was looking for (I know what he means, but I'm blank too).



    .


  6. #5
    Senior Member rosland's Avatar
    Join Date
    Jul 2003
    Location
    Norway
    Posts
    1,944
    Member #
    2096
    Quote Originally Posted by filburt1
    I could swear there's some function to reduce those five lines of variable assignments into a single line--assign the values of the array to their respective keys as separate variables--but I can't find it.
    Are you thinking of this one?

    [phpfunction]import_request_variables[/phpfunction]
    S. Rosland

  7. #6
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,715
    Member #
    5580
    Liked
    717 times
    Rosland ... I think that's it.

    One time, I had a form with dozens of variables, so I used that ... worked great.

    Normally, with only a couple of variables, I just do it the long way.
    But I think what you found is what I was thinking of.



Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 12:42 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com