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 4 of 4
  1. #1
    Junior Member
    Join Date
    Jul 2003
    Posts
    2
    Member #
    2203
    I'm trying to make a simple email form, but I'm having a really hard time with it. Would anyone mind looking over the script? I have it in two parts: an html file and a php file.

    html:

    <form method="post" action="email.php" name="billform">
    <input type="hidden" name="to" value="mchild2@osa.org">
    <input type="hidden" name="subject" value="High-speed Internet Access Billing">
    First Name:
    <input name="firstname" type="text" size="30">
    <br>
    Last Name:
    <input name="lastname" type="text" size="30">
    <br>
    Room #:
    <input name="roomno" type="text" size="5">
    <br>
    I wish to purchase
    <input name="days" type="text" size="5">
    days of internet access.<br>
    <input type="submit" name="Submit" value="I Authorize Billing">
    &
    <input type="reset" name="Clear" value="Clear">
    </font></p>
    </form>

    The PHP doc (in its entirety):
    <?php

    $msg = array($firstname, $lastname, $roomno, $days);
    $firstname = 'firstname';
    $lastname = 'lastname';
    $roomno = 'roomno';
    $days = 'days';

    $mailheaders = "$REMOTE_ADDR\n";

    mail($name, $email, join("\n", $msg), $mailheaders);

    ?>
    <html>
    <head>
    <title> Thank you </title>
    <style type="text/css">
    #main
    {position: absolute;
    top: 200px;
    left: 325px;
    width:450 px;
    }
    </style>
    <script language="JavaScript"><!--
    setTimeout("top.location.href = 'http://www.yahoo.com'",0);
    //--></script>
    </head>
    <body>
    <div id="main">
    Thank you for your submission. If you are not redirected, please <a href=http://www.yahoo.com">click here</a>.
    </div>
    </body>


    When I fill out the form and click send, it sends me to the "thank you" page which redirects me, but I never receive an email. Can anyone help me?

  2.  

  3. #2
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    Try this...
    PHP Code:
    <?php
    $firstname 
    $_POST['firstname'];
    $lastname $_POST['lastname']; 
    $roomno $_POST['roomno']; 
    $days $_POST['days'];
    $ip $_SERVER['REMOTE_ADDR'];

    $message =
    "First Name: $firstname\n
    Last Name: 
    $lastname\n
    Room No: 
    $roomno\n
    Days: 
    $days\n\n
    IP: 
    $ip";

    $mailto "your e-mail address";
    $subject "the subject of the mail";

    if (
    mail($mailto$subject$message)) {
    $success "Thank you for your submission.
    If you are not redirected, please <a href='http://www.yahoo.com'>
    click here</a>."
    ;
    } else {
    $success "Sorry, your submission has failed.
    Please click back and try again"
    ;
    ?>
    <html> 
    <head> 
    <title> Thank you </title> 
    <style type="text/css"> 
    #main 
    {position: absolute; 
    top: 200px; 
    left: 325px; 
    width:450 px; 

    </style> 
    <script language="JavaScript"><!-- 
    setTimeout("top.location.href = 'http://www.yahoo.com'",0); 
    //--></script> 
    </head> 
    <body> 
    <div id="main"> 
    <?php echo $success ?>
    </div> 
    </body>
    change $mailto to your e-mail address and $subject to the subject of the mail. Should work, if it doesn't post a reply
    JR

  4. #3
    Junior Member
    Join Date
    Jul 2003
    Posts
    2
    Member #
    2203
    The only problem I'm having is

    Parse error: parse error in /home/enginuit/public_html/stateplaza/email.php on line 47

    It looks like that's the line under </body>... I tried adding a </html>, but that doesn't seem to help.

    BTW, thank you so much for your help!!!!

  5. #4
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    sorry, forgot to put a } just before the first ?>

    here...
    PHP Code:
    click here</a>.";
    } else {
    $success = "Sorryyour submission has failed.
    Please click back and try again";
    }
    ?> 
    Should work now
    JR


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