Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

Results 1 to 4 of 4

Thread: PHP Form Mailer Problem

  1. #1
    3
    posts
    Registered User

    PHP Form Mailer Problem

    hey guys,

    I am having abit of trouble with the php form mailer from the tutorial here is my html code.


    HTML Code:
    <link href="css/custom-theme/jquery-ui-1.7.2.custom.css" rel="stylesheet" type="text/css" media="screen" />
    <script type="text/javascript" src="js/jquery.validate.min.js"></script>
    <script type="text/javascript" src="js/cmxforms.js"></script>
    <script type="text/javascript" src="http://jquery-ui.googlecode.com/svn/trunk/ui/ui.core.js"></script>
    <script type="text/javascript" src="http://jquery-ui.googlecode.com/svn/trunk/ui/ui.datepicker.js"></script>
    <script>
          $(document).ready(function(){
                $("#reserve-form").validate();
          });
    
            $(function() {
                $("#chkin, #chkout").datepicker({showOn: 'button', buttonImage: 'images/calendar.gif', buttonImageOnly: true});
            });
    </script>
    
    <div class="center" id="content">
        <div class="content-box">
            <form action="http://www.thecozibangkok.com/mailer.php" method="post" enctype="text/plain" id="reserve-form" class="cmxform">
                    <h2>Reservation Form</h2>
                    <fieldset>
                        <p>
                            <label for="fname">First Name: (required)</label> 
                            <input type="text" name="firstname" value="Your First Name" size="30" class="required" minlength="2" />
                        </p>
                        <p>
                            <label for="lname">Last Name: (required)</label> 
                            <input type="text" name="lastname" value="Your Last Name" size="30" class="required" minlength="2" />
                        </p>
                        <p>
                            <label for="email">Email: (required)</label> 
                            <input type="text" name="email" value="you@yourcompany.com" size="30" class="required email" />
                        </p>
                        <p>&nbsp;</p>
                        <p class="instruction">Please click the mini calendar to pick a date.</p>
                        <p>
                            <label for="checkin">Check In: (required)</label> 
                            <input id="chkin" type="text" name="checkin" value="" size="30" class="required date" />
                            
                        </p>
                        <p>
                            <label for="checkout">Check Out: (required)</label> 
                            <input id="chkout" type="text" name="checkout" value="" size="30" class="required date" />
                            
                        </p>
                        <p>&nbsp;</p>
                        <p>
                            <label for="room">Room Type: (required)</label> 
                            <select name="room" class="required">
                                <option value="">Choose Room Type:</option>
                                <option value="standard">Cozi Standard</option>
                                <option value="superior">Cozi Superior</option>
                                <option value="deluxe">Cozi Deluxe</option>
                                <option value="suite">Cozi Suite</option>
                            </select>
                        </p>
                        <p><label>Remarks:</label></p>
                            <textarea name="remarks" class="textbox" cols="40" rows="10">Please write any extra remarks here...</textarea>
                        
                        <p class="buttons">                        
                            <input class="button" type="reset" value="Reset">
                            <input class="button" type="submit" name="submit" value="Submit">
                        </p>
    
                        
    
                    </fieldset>
            </form>            
        </div>
    </div>
        
        
    here is my php mailer.

    PHP Code:
    <?PHP 
    $to 
    "reserve@thecozibangkok.com";
    $subject "Reservation Form";
    $headers "From: thecozibangkok.com";
    $forward 1
    $location "http://www.thecozibangkok.com"
    $date date ("l, F jS, Y"); 
    $time date ("h:i A"); 

    $msg "Below is the result of your feedback form. It was submitted on $date at $time.\n\n"

    if (
    $_SERVER['REQUEST_METHOD'] == "POST") {
        foreach (
    $_POST as $key => $value) { 
            
    $msg .= ucfirst ($key) ." : "$value "\n"
        }
    }
    else {
        foreach (
    $_GET as $key => $value) { 
            
    $msg .= ucfirst ($key) ." : "$value "\n"
        }
    }

    mail($to$subject$msg$headers); 
    if (
    $forward == 1) { 
        
    header ("Location:$location"); 

    else { 
        echo 
    "Thank you for submitting our form. We will get back to you as soon as possible."


    ?>
    please help, all i am getting in my email is Below is the result of your feedback form. It was submitted on (date) at (time)" in my email, i don't get the info that the user submitted.

    Thx Guys!

  2. #2
    439
    posts
    Registered User
    Hi,

    try removing the 'ucfirst()' function, it capatalises the first letter of a string and in your form your form vars [name etc] are lower case.

    So I guess you could change this:

    PHP Code:
    $msg .= ucfirst ($key) ." : "$value "\n"
    to this:

    PHP Code:
    $msg .= $key ." : "$value "\n"

    hope this helps.

    while ( ! ( succeed = try() ) );

  3. #3
    3
    posts
    Registered User
    Quote Originally Posted by Patch^ View Post
    Hi,

    try removing the 'ucfirst()' function, it capatalises the first letter of a string and in your form your form vars [name etc] are lower case.

    So I guess you could change this:

    PHP Code:
    $msg .= ucfirst ($key) ." : "$value "\n"
    to this:

    PHP Code:
    $msg .= $key ." : "$value "\n"

    hope this helps.

    hey thanks for the reply, I gave that ago but it didn't work i am still recieving empty email with no form info in it. anything else you can think of?

  4. #4
    3
    posts
    Registered User
    Hey,

    Would like to udpate on this, the script works all i had to do was remove the

    enctype="text/plain"

    from the form

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
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012