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 2 of 2
  1. #1
    Junior Member manuleka's Avatar
    Join Date
    Apr 2005
    Posts
    4
    Member #
    9745
    i'm doing a simple site for a friend and one of the pages is gonna have a registration form! i'm very new to php and wanting to learn more but i need to know if its possible to have a form that will handle a few inputs..

    for example:

    name:
    contacts: email, phone, address, region etcs
    extras... etc etc

    will it be possible to have a form handler that will send all this information to an email once submitted? i'm after something simple...

    are there readly available scripts for this? or can anyone throw me one? so i can customize it myself? i'll learn as i go through it i suppose...

    thanks

  2.  

  3. #2
    Member
    Join Date
    Apr 2007
    Posts
    96
    Member #
    15165
    Quote Originally Posted by manuleka
    for example:

    name:
    contacts: email, phone, address, region etcs
    extras... etc etc

    will it be possible to have a form handler that will send all this information to an email once submitted? i'm after something simple...
    PHP Code:
    <?php
    $to          
    "webmaster@example.com";
    $redirectURL "thank_you.html";
    $subject     "Contact Form" "\r\n";

    if(!empty(
    $_REQUEST["Email"]))
        
    $from trim($_POST["Email"]);

    if(
    $from == "" )
        
    $from "server@example.com";

    $message "Here is what was submited." "\r\n";
    $message .= "\r\n";

    $error = array();

    if(!empty(
    $_REQUEST)  && is_array($_REQUEST))
    {
        while(list(
    $key$val) = each($_REQUEST))
        {
            if(
    in_array($key$required))
            {
                if(empty(
    $val))
                    
    $error[$key] = $key " is required.\r\n";
            }

            if(
    get_magic_quotes_gpc())
            
    $val stripslashes($val);
            
            
    $message .= $key ": ";
            
    $message .= $val;
            
    $message .= "\r\n\r\n";

        }
    }


    if(
    count($error))
    {
        echo 
    "There was a problem processing your request." "<br />\n";
        echo 
    "The following form fields are required." "<br />\n";

        while(list(
    $key$val) = each($error))
        {
            echo 
    $val "<br />\n";
        }

        echo 
    "Please click back in your browser window." "<br />\n";

    }
    else
    {
        
    $headers 'From: ' $from "\r\n";
        
    $headers .= 'X-Mailer: Webform' "\r\n";
        
        
    mail($to$subject$message$headers);
        
        
    header("Location: " $redirectURL);
    }
    ?>


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 07:32 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com