Jump to content

Newbie Form Help...


hedjunta

Recommended Posts

Hello oh wise ones...

 

I am a graphic designer and illustrator just trying to make it in the world, which means for me, creating

the ocassional website. Adding a simple email form is one thing I like to supply to my clients.

 

I've had some succes in the past, using PHP, but when I get the opportunity, I try and upgrade what I'm using.

 

In the latest sight I'm working on, I've used this PHP code to Post a form.

 

<?php

$sendTo = "[email protected]";

$subject = "Contact Request";

$headers = "From: " . $_POST["name"];

$headers .= "<" . $_POST["email"] . ">\r\n";

$headers .= "Reply-To: " . $_POST["email"] . "\r\n";

$headers .= "Return-Path: " . $_POST["email"] . "\r\n";

$headers .= "Name: " . $_POST["name"] . "\r\n";

$headers .= "Company: " . $_POST["company"] . "\r\n";

$headers .= "Address : " . $_POST["address"] . "\r\n";

$headers .= "City: " . $_POST["city"] . "\r\n";

$headers .= "State: " . $_POST["state"] . "\r\n";

$headers .= "Zip Code: " . $_POST["zip"] . "\r\n";

$headers .= "phone: " . $_POST["phone"] . "\r\n";

$message = $_POST["message"];

mail($sendTo, $subject, $message, $headers);

?>

 

But when I get the email some of the fields don't show, in Paticular these five. 

 

$headers .= "Name: " . $_POST["name"] . "\r\n";

$headers .= "Company: " . $_POST["company"] . "\r\n";

$headers .= "Address : " . $_POST["address"] . "\r\n";

$headers .= "City: " . $_POST["city"] . "\r\n";

$headers .= "State: " . $_POST["state"] . "\r\n";

 

I've used this before, but this time I am trying to work in the whole, "From" , "Reply To" and "Return-Path"

thing, which is a really conveneient addition. And that portion is working correctly.

 

Can anyone see why only the Zip Code, Phone Number and Message fields would work return ?

Thanks in advance for you help and knowledge.

 

Bill

www.billgaines.com

 

Link to comment
https://forums.phpfreaks.com/topic/44698-newbie-form-help/
Share on other sites

We need to actual form that gets submitted.

 

Edit:

 

Actually this


$headers .= "Name: " . $_POST["name"] . "\r\n";
$headers .= "Company: " . $_POST["company"] . "\r\n";
$headers .= "Address : " . $_POST["address"] . "\r\n";
$headers .= "City: " . $_POST["city"] . "\r\n";
$headers .= "State: " . $_POST["state"] . "\r\n";

 

should be

 

$message = $_POST["message"];
$message .= "Name: " . $_POST["name"] . "\n";
$message .= "Company: " . $_POST["company"] . "\n";
$message .= "Address : " . $_POST["address"] . "\n";
$message .= "City: " . $_POST["city"] . "\n";
$message .= "State: " . $_POST["state"] . "\n";

 

I do not think the headers include the name company etc. You want that in the message.

Link to comment
https://forums.phpfreaks.com/topic/44698-newbie-form-help/#findComment-217052
Share on other sites

Should I paste that code here, or a link to the development site ?

 

The development site is at the URL below,

 

http://www.billgaines.com/brickhouseweb

 

It uses a flash navigation, so I can't give you a direct link to the contact page.

But if you click on Contact us you'll see the form. ( sending the form doesn't require

the flash navigation)

 

and what the heck, here is the code for the form on that page...

 

Thank you !!!

 

 

<form action="contactus.php" method="post" name="form1" target="body">

           

            <table width="363" border="0" cellspacing="0" cellpadding="0">

              <tr>

                <th width="111" align="right" valign="bottom" class="style3" scope="col"><div align="left"></div></th>

                <th width="10" scope="col"> </th>

                <th width="242" scope="col"> </th>

              </tr>

              <tr>

                <td width="111" align="right" valign="middle" class="style5"><div align="left">Name:</div></td>

                <td width="10"> </td>

                <td width="242" align="left" valign="middle"><input name="name" type="text" id="name" size="30"></td>

              </tr>

              <tr>

                <td width="111" align="right" valign="middle" class="style5"><div align="left">Company:</div></td>

                <td width="10"> </td>

                <td width="242" align="left" valign="middle"><input name="company" type="text" id="company" size="30"></td>

              </tr>

 

              <tr>

                <td width="111" align="right" valign="middle" class="style5"><div align="left">Address: </div></td>

                <td width="10"> </td>

                <td width="242" align="left" valign="middle"><input name="address" type="text" id="address" size="30"></td>

              </tr>

 

              <tr>

                <td width="111" align="right" valign="middle" class="style5"><div align="left">City:</div></td>

                <td width="10"> </td>

                <td width="242" align="left" valign="middle"><input name="city" type="text" id="city" size="30"></td>

              </tr>

              <tr>

                <td width="111" align="right" valign="middle" class="style5"><div align="left">State: </div></td>

                <td width="10"> </td>

                <td width="242" align="left" valign="middle"><select name="state" id="state">

                    <option value="AL">AL</option>

                    <option value="AK">AK</option>

                    <option value="AS">AS</option>

                    <option value="AZ">AZ</option>

                    <option value="AR">AR</option>

                    <option value="CA">CA</option>

                    <option value="CO">CO</option>

                    <option value="CT">CT</option>

                    <option value="DE">DE</option>

                    <option value="DC">DC</option>

                    <option value="FL">FL</option>

                    <option value="GA">GA</option>

                    <option value="HI">HI</option>

                    <option value="ID">ID</option>

                    <option value="IL">IL</option>

                    <option value="IN">IN</option>

                    <option value="IA">IA</option>

                    <option value="KS">KS</option>

                    <option value="KY">KY</option>

                    <option value="LA">LA</option>

                    <option value="ME">ME</option>

                    <option value="MD">MD</option>

                    <option value="MA">MA</option>

                    <option value="MI">MI</option>

                    <option value="MN">MN</option>

                    <option value="MS">MS</option>

                    <option value="MO">MO</option>

                    <option value="MT">MT</option>

                    <option value="NE">NE</option>

                    <option value="NV">NV</option>

                    <option value="NH">NH</option>

                    <option value="NJ">NJ</option>

                    <option value="NM">NM</option>

                    <option value="NY">NY</option>

                    <option value="NC">NC</option>

                    <option value="ND">ND</option>

                    <option value="OH" selected>OH</option>

                    <option value="OK">OK</option>

                    <option value="OR">OR</option>

                    <option value="PA">PA</option>

                    <option value="RI">RI</option>

                    <option value="SC">SC</option>

                    <option value="SD">SD</option>

                    <option value="TN">TN</option>

                    <option value="TX">TX</option>

                    <option value="UT">UT</option>

                    <option value="VT">VT</option>

                    <option value="VA">VA</option>

                    <option value="WA">WA</option>

                    <option value="WV">WV</option>

                    <option value="WI">WI</option>

                    <option value="WY">WY</option>

                </select></td>

              </tr>

              <tr>

                <td width="111" align="right" valign="middle" class="style5"><div align="left">Zip

                  Code: </div></td>

                <td width="10"> </td>

                <td width="242" align="left" valign="middle"><input name="zip" type="text" id="zip" size="30"></td>

              </tr>

              <tr>

                <td width="111" align="right" valign="middle" class="style5"><div align="left">E-mail:</div></td>

                <td width="10"> </td>

                <td width="242" align="left" valign="middle"><input name="email" type="text" id="email" size="30"></td>

              </tr>

              <tr>

                <td width="111" align="right" valign="middle" class="style5"><div align="left">Phone:</div></td>

                <td width="10"> </td>

                <td width="242" align="left" valign="middle"><input name="phone" type="text" id="phone" size="30"></td>

              </tr>

 

              <tr>

                <td align="right" valign="middle" class="style5"><div align="left">Question, Request, Comments : </div></td>

                <td> </td>

                <td width="242" align="left" valign="middle"><textarea name="message" cols="27" rows="2" id="message"></textarea></td>

              </tr>

              <tr>

                <td align="right" valign="bottom" class="style3"><div align="left"></div></td>

                <td> </td>

                <td width="242" align="left" valign="bottom"><input type="submit" name="Submit" value="Submit"></td>

              </tr>

            </table></form>

 

Link to comment
https://forums.phpfreaks.com/topic/44698-newbie-form-help/#findComment-217069
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.