Member Avatar for arobix

My client tells me that when he tests this code, he is asked to supply his email address when he has already entered it. When I test it, it goes through. It used to work and now it doesn't.

Here is the code for the form (Apply_Online.php):

<table width="750" border="0" align="center" cellpadding="0" cellspacing="0" class="Form_Labels">
        <tr>
          <td>
            <form id="form1" name="form1" method="post" action="Send_Email.php">
              <table width="575" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#000000">
                <tr>
                  <td><table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#E4E4E4">
                    <tr>
                      <td width="40%" bgcolor="#D0EAD3">Name</td>
                      <td width="60%" bgcolor="#FFFFFF"><input name="name" type="text" id="name" size="40" /></td>
                    </tr>
                    <tr>
                      <td bgcolor="#D0EAD3">Email Address </td>
                      <td bgcolor="#FFFFFF"><input name="email" type="text" id="email" size="40" /></td>
                    </tr>
                    <tr>
                      <td bgcolor="#D0EAD3">Phone (if you want us to call you)</td>
                      <td bgcolor="#FFFFFF"><input name="phone" type="text" id="phone" size="20" /> 
                        (Please include area code) </td>
                    </tr>
                    <tr>
                      <td bgcolor="#D0EAD3">Loan Amount Desired </td>
                      <td bgcolor="#FFFFFF"><span>$</span>
                        <input name="amount_desired" type="text" id="amount_desired" size="15" /></td>
                    </tr>
                    <tr>
                      <td bgcolor="#D0EAD3">Purpose of Loan </td>
                      <td bgcolor="#FFFFFF"><textarea name="purpose" cols="35" rows="5" id="purpose"></textarea></td>
                    </tr>
                    <tr>
                      <td bgcolor="#D0EAD3">Loan Property Type </td>
                      <td bgcolor="#FFFFFF"><select name="property_type" id="property_type">
                        <option>Please Choose One</option>
                        <option value="Residential">Residential</option>
                        <option value="Commercial">Commercial</option>
                        <option value="Multi-Family">Multi-Family</option>
                        <option value="Condo">Condo</option>
                        <option value="Industrial">Industrial</option>
                        <option value="Building Lot">Building Lot</option>
                        <option value="Acreage">Acreage</option>
                        <option value="Mobild and Land">Mobile and Land</option>
                        <option value="Construction Loan">Construction Loan</option>
                              </select></td>
                    </tr>
                    <tr>
                      <td bgcolor="#D0EAD3">Value of Loan Property </td>
                      <td bgcolor="#FFFFFF"><span>$</span>
                        <input name="property_value" type="text" id="property_value" size="15" /></td>
                    </tr>
                    <tr>
                      <td bgcolor="#D0EAD3">Approximate 1st Mortgage Balance</td>
                      <td bgcolor="#FFFFFF"><span>$</span>
                        <input name="mortgage1" type="text" id="first_mortgage" size="15" /></td>
                    </tr>
                    <tr>
                      <td bgcolor="#D0EAD3">Approximate 2nd Mortgage Balance </td>
                      <td bgcolor="#FFFFFF"><span>$</span>
                        <input name="mortgage2" type="text" id="second_mortgage" size="15" /></td>
                    </tr>
                  </table></td>
                </tr>
                <tr>
                  <td align="right"><input type="submit" name="Submit" value="Send Email --&gt;&gt;" />
                  &nbsp;&nbsp;&nbsp;</td>
                </tr>
              </table>
            </form>
            <p>&nbsp;</p>
          </td>
        </tr>
    </table>

And here is the code for Send_Email.php:

<?php        

    if($email != null)
        {   
            // Format the currency fields so they look like money in the email
            //setlocale(LC_MONETARY, 'en_US');
            $amount_desired = number_format($amount_desired);
            $property_value = number_format($property_value);
            $mortgage1 = number_format($mortgage1);
            $mortgage2 = number_format($mortgage2);
            $head  = "MIME-Version: 1.0\r\n";
            $head .= "Content-type: text/html; charset=iso-8859-1\r\n"; 
            $head .= "From: $email\r\n";
            $to    = "rhrussell@charter.net";
            //$to    = "info@umpquawebdesign.com";      
            $subject = "Loan Request from GregRussellOregon.com";
            $body  =    "<p>Loan Request:</p>
                        <blockquote><strong>
                            Name:  $name<br />
                            Email: $email<br />
                            Phone: $phone<br />
                            Property Type: $property_type<br />
                            Amount Desired: $ $amount_desired<br />
                            Property Value: $ $property_value<br />
                            First Mortgage: $ $mortgage1<br />
                            Second Mortgage: $ $mortgage2<br />
                        </strong></blockquote>
                        <br />
                        <blockquote>
                            <strong>Purpose of Loan:</strong> $purpose<br />
                        </blockquote>";

            $retval = mail($to, $subject, $body, $head);

            if ( $retval ) // If the email was sent, redirect
                {   
                    $result = "Thank You!  Your message has been sent.<br />
                            We will be sure to get back to you just as soon as we can."; 
                }
            elseif(!$retval)
                {
                    $result = "Sorry, your message was not sent.<br />
                            Please hit your browser's Back button and try again.";
                }
        }
    else
        { $result = "Sorry, you must enter an email address so we have some idea of how to get in touch with you."; }
?>

I cannot see:

$email = $_POST['email']

or anywhere that you declare $email as a variable therefore it is always false

Member Avatar for arobix

I wondered if that would do it, but I wasn't positive. I'll try it.

Member Avatar for arobix

It works. Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.