Results 1 to 4 of 4

Thread: adding more info on PHP form

  1. #1
    Join Date
    Aug 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default adding more info on PHP form

    Hi

    I have been trying to add a few more lines (info) to a PHP form bascially to have info as per below;Info comes from HTML page 'advertisement form' then once filled in and submitted a thank you page appears

    name
    business name
    website
    email address
    advertisement category
    comments

    I have so far added (i hope) business name and website to this form as per below. Could somebody let me know that I am on the right track? thank you


    $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
    $name = $_POST['name'] ;
    $business name = $_POST['business name'] ;
    $website = $_POST['website'] ;
    $email = $_POST['email'] ;
    $comments = $_POST['comments'] ;
    $http_referrer = getenv( "HTTP_REFERER" );

    if (!isset($_POST['email'])) {
    header( "Location: $formurl" );
    exit ;
    }
    if (empty($name) || empty($email) || empty($comments)) {
    header( "Location: $errorurl" );
    exit ;
    }
    if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
    header( "Location: $errorurl" );
    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, $subject, $messageproper,
    "From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer:

    chfeedback.php 2.07" );
    header( "Location: $thankyouurl" );
    exit ;

    ?>

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Now is the above code the entire program, or just a part of it. The only problems that I could see is a few variables that are not in the code above. But if its not the whole thing, just ignore what I just said. Other than that it should work.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Aug 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Reply

    Hi

    This is the PHP part of the form, the other part is the actual HTML page which is called AdvertiseForm.html with the tables on etc, then a Thank you (thankyou.html) page that appears after filling out the form (if this is what you mean't)?

    Please let me know if I somehow? need to add the additional selections of Business name - Website - Advertising Category to the code below which is part of the form sent in email below this email, for this form to work?

    Also please find attached the HTML page which will be (Advertiseform.html) at the moment it is called (thankyou2.html) this is attached as a ZIP Folder.

    Thank you for your help

    if (!isset($_POST['email'])) {
    header( "Location: $formurl" );
    exit ;
    }
    if (empty($name) || empty($email) || empty($comments)) {
    header( "Location: $errorurl" );
    exit ;
    }
    if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
    header( "Location: $errorurl" );
    exit ;
    }

    if (get_magic_quotes_gpc()) {
    $comments = stripslashes( $comments );

  4. #4
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    one thing that I have noticed in the beginning (<< spelling?) part of the php code, heres your code:

    PHP Code:
    $name $_POST['name'] ;
    $business name $_POST['business name'] ;
    $website $_POST['website'] ;
    $email $_POST['email'] ;
    $comments $_POST['comments'] ;
    $http_referrer getenv"HTTP_REFERER" ); 
    when it should actually be like this:

    PHP Code:
    $name $_POST['name'];
    $business $_POST['business'];
    $website $_POST['Website'];
    $email $_POST['email'];
    $comments $_POST['comments'];
    $advert $_POST['Advert'];
    $http_referrer getenv"HTTP_REFERER" ); 
    Other than those points of interest, the rest should work as planned. If you still need any help, let me know and also, sorry I did not get to this sooner. I have been extremely busy at work.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

Bookmarks

Posting Permissions

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