Jump to content

Form to email


Brett

Recommended Posts

I can get "Name" etc to show on the email but not the value. eg:

Name: 

What I need is

Name: Joe Smith

Here is the code:

<?php

if($_POST["submit"]) {
    $recipient="my@email.address";
    $subject="Form to email message";
    $sender=$cemail;

    $mailBody="Customers Business Name: $cbname\n
	$cname=Customers Name: $cname\n
	$caddress=Customers Address: $caddress\n
	$csuburb=Customers Suburb: $csuburb\n
	$ccity=Customers City: $ccity\n
	$cphone=Customers Phone Number: $cphone\n
	$cemail=Customers Email: $cemail\n\n

	$sbname=Senders Business Name: $sbname\n
	$sname=Senders Name: $sname\n
	$saddress=Senders Address: $saddress\n
	$ssuburb=Senders Suburb: $ssuburb\n
	$scity=Senders City: $scity\n
	$sphone=Senders Phone Number: $sphone\n\n

	$rbname=Receivers Business Name: $rbname\n
	$rname=Receivers Name: $rname\n
	$raddress=Receivers Address: $raddress\n
	$rsuburb=Receivers Suburb: $rsuburb\n
	$rcity=Receivers City: $rcity\n
	$rphone=Receivers Phone Number: $rphone\n\n

	$item=Item: $item\n
	$length=Length: $length\n
	$width=Width: $width\n
	$height=height: \n\n

$message=Additional Information: "$message;

    mail($recipient, $subject, $mailBody, "From: $sender <$cemail>");

header('Location: thanks.php');
}
?>

Here is the form

<!DOCTYPE html>

<html>
<head>
    <meta charset="utf-8">
    <title>Contact form to email</title>
</head>

<body>


    <form method="post" action="action.php">
        <label>Customers Business Name:</label>
        <input name="cbname"><br>

        <label>Customers Name:</label>
        <input name="cname"><br>

        <label>Cusotmers Address:</label>
        <input name="caddress"><br>

        <label>Customers Suburb:</label>
        <input name="csuburb"><br>

        <label>Customers City:</label>
        <input name="ccity"><br>

        <label>Customers Phone Number:</label>
        <input name="cphone"><br>

        <label>Customers Email:</label>
        <input name="cemail"><br>

        <label>Senders Business Name:</label>
        <input name="sbname"><br>

        <label>Senders Name:</label>
        <input name="sname"><br>

       <label>Senders Address:</label>
        <input name="saddress"><br>

         <label>Senders Suburb:</label>
        <input name="ssuburb"><br>

         <label>Senders City:</label>
        <input name="scity"><br>

         <label>Senders Phone Number:</label>
        <input name="sphone"><br>

        <label>Receivers Business Name:</label>
        <input name="rbname"><br>

        <label>Receivers Name:</label>
        <input name="rname"><br>

       <label>Receivers Address:</label>
        <input name="raddress"><br>

         <label>Receivers Suburb:</label>
        <input name="rsuburb"><br>

         <label>Receivers City:</label>
        <input name="rcity"><br>

         <label>Receivers Phone Number:</label>
        <input name="rphone"><br>

        <label>Item:</label>
        <input name="item"><br>

         <label>Length in cm:</label>
        <input name="length"><br>

         <label>Width in cm:</label>
        <input name="width"><br>

         <label>Height in cm:</label>
        <input name="hight"><br>

         <label>Weight in kg:</label>
        <input name="weight"><br>

        <label>Additional Information:</label>
        <textarea rows="5" cols="20" name="info"></textarea>

        <input type="submit" name="submit">
    </form>

</body>

</html>

Thanks for any help for can give.

Link to comment
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.