Jump to content

Recommended Posts

Hi, I've created an email form on my website by following a guide. I now have two files:

 

contact.htm...

<form method=post action="sendmail.php">
  <table width="691" border="0" cellpadding="5" cellspacing="0">
    <tr>
        <td width="185" class="white">
        <p align="left">your name:</p>        </td>
        <td width="29"> </td>
        <td width="447"><input name="name" type="text" size="40" />        </td>
    </tr>
    <tr>
        <td class="white">
        <p align="left">your email address:</p>        </td>
        <td> </td>
        <td><input name="email" type="text" size="40" />        </td>
    </tr>
    <tr>
<tr>
        <td class="white">
        <p align="left">your phone number:</p>        </td>
        <td> </td>
        <td><input name="phoneNumber" type="text" size="40" />        </td>
    </tr>
    <tr>
        <td valign="top" class="white"><p align="left">best time to contact you?</p>        </td>
        <td valign="top"> </td>
        <td valign="top">
            <select name="bestTime">
			<option value="none" selected="selected">please select...</option>
                <option value="Weekday morning">weekday morning</option>
                <option value="Weekday afternoon">weekday afternoon</option>
                <option value="Weekend">weekend</option>
                <option value="Any time">any time</option>
        </select>      </td>
    </tr>
    <tr>
        <td valign="top" class="white"><p align="left">preferred method of contact?</p>        </td>
        <td valign="top"> </td>
        <td valign="top">
            <select name="contactMethod">
			<option value="none">please select...</option>
                <option value="email">by email</option>
                <option value="phone">by phone</option>
            </select>      </td>
    </tr>  
    <tr>
        <td valign="top" class="white">
        <p align="left">please enter your questions<br /> 
        or comments below:</p>        </td>
        <td> </td>
        <td><textarea name="message" rows="5" cols="50"></textarea>        </td>
    </tr>
    <tr>
        <td> </td>
        <td></td>
        <td><input name="submit" type="submit" value="Click to Send" /></td>
    </tr>
    </table>
  <div align="right"></div>
</form>

 

and Sendmail.php...

<?php

mail("info@mydomainname.co.uk", "From your Contact Form...", $_REQUEST[message], "From: $_REQUEST[email]", "-f".$_REQUEST[email]);

header( "Location: http://www.mydomainname.co.uk/thankyou.htm" );

?>

 

It is actually working fine although when I receive the email it doesn't include all of the information. It only includes the contents of the "message" field. Can you help me so that i will be recieving all the information in the received email?

 

Kind regards,

Alistair

Link to comment
https://forums.phpfreaks.com/topic/44323-solved-e-mail-form/
Share on other sites

<?php

$msg = "\"".$_POST['name']."\" wrote:\n"
$msg .= $_POST['message']."\n\n\n";
$msg .= "Other details:\n";
$msg .= "Email- ".$_POST['email']."\n";
$msg .= "Phone #- ".$_POST['phoneNumber']."\n";
$msg .= "Best time- ".$_POST['bestTime']."\n";
$msg .= "Contact method- ".$_POST['contactMethod']."\n";


mail("info@mydomainname.co.uk", "From your Contact Form...", $msg, "From: ".$_REQUEST['email'], "-f".$_REQUEST[email]);

header( "Location: http://www.mydomainname.co.uk/thankyou.htm" );

?>

 

 

Orio.

Link to comment
https://forums.phpfreaks.com/topic/44323-solved-e-mail-form/#findComment-215256
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.