Help with PHP Form Issues

Hey guys,

I’ve been doing some work for this company’s website and have had to convert it to WordPress. However, WordPress isn’t the one giving me the issue. I am setting up some basic forms that email the results to the marketing department. However, only one page works 100% - here is the code:

[php]
<?php
if (isset($_POST[‘submit’])&&$_POST[‘submitted_by’]!=""&&$_POST[‘submitted_email’]!=""){
$to = ‘[email protected]’;
$subject = ‘New Contract Info Request from choicetitle.com’;
$message = 'Property Address: ’ .$_POST[‘property_address’] . “\n\n”;
$message .= 'Estimated Closing Date: ’ .$_POST[‘closing_date’] ."\n";
$message .= 'Sales Price: ’ .$_POST[‘selling_price’] ."\n";
$message .= 'Listing Agent: ’ .$_POST[‘listing_agent’] ."\n";
$message .= 'Listing Company: ’ .$_POST[‘listing_company’] ."\n";
$message .= 'Listing Office Phone: ’ .$_POST[‘listing_office_phone’] ."\n";
$message .= 'Fax: ’ .$_POST[‘listing_fax’] ."\n";
$message .= 'Listing Email: ’ .$_POST[‘listing_email’] ."\n";
$message .= 'Listing Cell Phone: ’ .$_POST[‘listing_cell_phone’] ."\n";
$message .= 'Commission: ’ .$_POST[‘listing_commission’] ."\n";
$message .= 'As Is?: ’ .$_POST[‘radio’] ."\n";
$message .= 'Home Warranty Company: ’ .$_POST[‘Home_warranty_company’] ."\n";
$message .= 'Amount: ’ .$_POST[‘amount’] ."\n";
$message .= ‘--------------------------’."\n";
$message .= 'Seller Names: ’ .$_POST[‘seller_names’] ."\n";
$message .= 'Seller Home Phone: ’ .$_POST[‘seller_home_phone’] ."\n";
$message .= 'Seller Work Phone: ’ .$_POST[‘seller_work_phone’] ."\n";
$message .= 'Seller Cell Phone: ’ .$_POST[‘seller_cell_phone’] ."\n";
$message .= 'Selling Agent: ’ .$_POST[‘selling_agent’] ."\n";
$message .= 'Selling Company: ’ .$_POST[‘selling_company’] ."\n";
$message .= ‘Seller Fax’ .$_POST[‘seller_fax’] ."\n";
$message .= ‘Seller Office Phone’ .$_POST[‘seller_office_phone’] ."\n";
$message .= ‘Seller Email’ .$_POST[‘seller_email’] ."\n";
$message .= ‘Seller Agent Email’ .$_POST[‘seller_agent_email’] ."\n";
$message .= 'Seller Commission: ’ .$_POST[‘seller_commission’] ."\n";
$message .= ‘--------------------------’."\n";
$message .= 'Termite Company: ’ .$_POST[‘termite’] ."\n";
$message .= 'Buyer Names: ’ .$_POST[‘buyer_names’] ."\n";
$message .= 'Buyer Home Phone: ’ .$_POST[‘buyer_home_phone’] ."\n";
$message .= 'Buyer Work Phone: ’ .$_POST[‘buyer_work_phone’] ."\n";
$message .= 'Buyer Cell Phone: ’ .$_POST[‘buyer_cell_phone’] ."\n";
$message .= 'Buyer Email: ’ .$_POST[‘buyer_email’] ."\n";
$message .= 'Comments: ’ .$_POST[‘comments’] ."\n";
$message .= 'Submitted by: ’ .$_POST[‘submitted_by’] ."\n";
$message .= 'Email Address: ’ .$_POST[‘submitted_email’] ."\n";

							mail($to, $subject, $message);
							echo 'Thank You. Your request has been submitted.';
						}
						else if (isset($_POST['submit'])){

							echo '<strong>Please complete the required fields marked with an asterisk (*).</strong>';
							$error_class = 'class="required"';
						} else {
						}?>
						<strong>All required fields are marked with an asterisk (*).</strong>
					<form action="<?php $_SERVER['php_self']?>" method="post" accept-charset="utf-8" id="new_contr">
						<table id="forms" width="600" border="0" cellpadding="0" cellspacing="0">
						                  <tr>
						                    <td valign="top">Property Address:</td>
						                    <td colspan="3"><input name="property_address" type="text" id="property_address" size="45"></td>
						                  </tr>
						                  <tr>
						                    <td valign="top">Estimated Closing Date:</td>
						                    <td valign="top"><input name="closing_date" type="text" id="closing_date" size="20"></td>
						                    <td valign="top">Sales Price:</td>
						                    <td valign="top"><input name="selling_price" type="text" id="selling_price" value="$" size="20"></td>
						                  </tr>
						                  <tr>
						                    <td colspan="4"><hr /></td>
						                  </tr>
						                  <tr>
						                    <td height="21" >Listing Agent:</td>
						                    <td colspan="3"><input name="listing_agent" type="text" id="listing_agent" size="45"></td>
						                  </tr>
						                  <tr>
						                    <td valign="top">Listing Company:</td>
						                    <td colspan="3"><input name="listing_company" type="text" id="listing_company" size="45"></td>
						                  </tr>
						                  <tr>
						                    <td valign="top">Office Phone:</td>
						                    <td valign="top"><input name="listing_office_phone" type="text" id="listing_office_phone" size="20"></td>
						                    <td valign="top">Fax:</td>
						                    <td valign="top"><input name="listing_fax" type="text" id="listing_fax" size="20"></td>
						                  </tr>
						                  <tr>
						                    <td valign="top">Cell Phone:</td>
						                    <td valign="top"><input name="listing_cell" type="text" id="listing_cell" size="20"></td>
						                    <td valign="top">E-mail Address:</td>
						                    <td valign="top"><input name="listing_email" type="text" id="listing_email" size="20"></td>
						                  </tr>
						                  <tr>
						                  <td valign="top">Commission:</td>
						                  <td valign="top"><input name="listing_commission" type="text" id="listing_commission" size="20"></td>
						                    <td valign="top">As Is?</td>
						                    <td valign="top"><label>
						                      <input type="radio" name="radio" id="asis_yes" value="yes" />
						                    Yes&nbsp;&nbsp;&nbsp;</label>
											<label>
						                    <input type="radio" name="radio" id="asis_no" value="no" />
						                    No</label></td>
						                    </tr>
						                    <tr>
						                    <td valign="top">Home Warranty Company:</td>
						                    <td valign="top"><input name="Home_Warranty_Company" type="text" id="Home_Warranty_Company" size="20"></td>
						                    <td valign="top">Amount:</td>
						                    <td valign="top"><input name="amount" type="text" id="amount" value="$" size="20"></td>
						                  </tr>
						                  <tr>
						                    <td valign="top">Seller Names:</td>
						                    <td colspan="3"><input name="seller_names" type="text" id="seller_names" size="45"></td>
						                  </tr>
						                  <tr>
						                    <td valign="top">Home Phone:</td>
						                    <td valign="top"><input name="seller_home_phone" type="text" id="seller_home_phone" size="20"></td>
						                    <td valign="top">Work Phone:</td>
						                    <td valign="top"><input name="seller_work_phone" type="text" id="seller_work_phone" size="20"></td>
						                  </tr>
						                  <tr>
						                    <td valign="top">Cell Phone:</td>
						                    <td valign="top"><input name="seller_cell" type="text" id="seller_cell" size="20"></td>
						                    <td valign="top">E-mail Address:</td>
						                    <td valign="top"><input name="seller_email" type="text" id="seller_email" size="20"></td>
						                  </tr>
						                    <td colspan="4"><hr /></td>
						                  </tr>
						                  <tr>
						                    <td valign="top">Selling Agent:</td>
						                    <td colspan="3"><input name="selling_agent" type="text" id="selling_agent" size="45"></td>
						                  </tr>
						                  <tr>
						                    <td valign="top">Selling Company:</td>
						                    <td colspan="3"><input name="selling_company" type="text" id="selling_company" size="45"></td>
						                  </tr>
						                  <tr>
						                    <td valign="top">Office Phone:</td>
						                    <td valign="top"><input name="seller_office_phone" type="text" id="sell_office_phone" size="20"></td>
						                    <td valign="top">Fax:</td>
						                    <td valign="top"><input name="seller_fax" type="text" id="sell_fax" size="20"></td>
						                  </tr>
						                  <tr>
						                    <td valign="top">Cell Phone:</td>
						                    <td valign="top"><input name="sell_cell_phone" type="text" id="sell_cell_phone" size="20"></td>
						                    <td valign="top">E-mail Address:</td>
						                    <td valign="top"><input name="seller_agent__email" type="text" id="sell_email" size="20"></td>
						                  </tr>
						                  <tr>
						                  <td valign="top">Commission:</td>
						                  <td valign="top"><input name="seller_commission" type="text" id="sell_commission" size="20"></td>
						                  <td valign="top">Termite Company:</td>
						                  <td valign="top"><input name="termite" type="text" id="termite" size="20"></td>
						                    </tr>
						                  <tr>
						                    <td valign="top">Buyer Names:</td>
						                    <td colspan="3"><input name="buyer_names" type="text" id="buyer_names" size="45"></td>
						                  </tr>
						                  <tr>
						                    <td valign="top">Home Phone:</td>
						                    <td valign="top"><input name="buyer_home_phone" type="text" id="buyer_home_phone" size="20"></td>
						                    <td valign="top">Work Phone:</td>
						                    <td valign="top"><input name="buyer_work_phone" type="text" id="buyer_work_phone" size="20"></td>
						                  </tr>
						                  <tr>
						                    <td valign="top">Cell Phone:</td>
						                    <td valign="top"><input name="buyer_cell" type="text" id="buyer_cell" size="20"></td>
						                    <td valign="top">E-mail Address:</td>
						                    <td valign="top"><input name="buyer_email" type="text" id="buyer_email" size="20"></td>
						                  </tr>
						                  <tr>
						                    <td  valign="top">Comments:</td>
						                    <td colspan="3"><textarea name="comments" cols="55" rows="4" id="comments"></textarea></td>
						                  </tr>
						                  <tr>
						                    <td colspan="4"><hr /></td>
						                  </tr>
						                  <tr align="center">
						                    <td valign="top"><div >Submitted By:<span class="redtext">*</span>: </div></td>
						                    <td valign="top"><input name="submitted_by" type="text" id="submitted_by" size="20"></td>
						                    <td valign="top"><div >E-mail Address<span class="redtext">*</span>: </div></td>
						                    <td valign="top"><input name="submitted_email" type="text" id="email" size="20"></td>
						                  </tr>
						                  <tr align="center">
						                    <td colspan="4">&nbsp;</td>
						                  </tr>

						                  <TR>
						                      <TD colspan="4">By clicking the "Submit" button on this form, you are authorizing our staff to begin the closing process. One of our staff members will contact you shortly to confirm your order and to collect additional information regarding your request.</TD>
						                    </TR>
						                  <tr>
						                    <td colspan="4"><div align="center">
						                        <input name="submit" type="submit" value="Submit Form">
						                    </div></td>
						                  </tr>
						                      <tr align="center">
						                    <td colspan="4">Thank You for Choosing Choice Title, Inc.<br></td>
						                  </tr>
						                </table>
						</form>

[/php]

Since that code works, I’ve tried setting up the other form pages using this format, but it is not working at all. For instance, this one page I’m about to post the code for needs to redirect to a certain page depending on one of the choices the users pick. Instead, it reloads a blank WordPress page.

[php]

<?php if (isset($_POST['submit'])&&$_POST['i_am_a']!=""&&$_POST['name']!=""&&$_POST['email']!=""&&$_POST['interests']!=""){ $to = '[email protected]'; $subject = 'Choice Title Printable Forms'; $goto_ = 'forms/' .$_POST['i_am_a']; $message = 'Name: ' .$_POST['name'] . "\n"; $message .= 'Email: ' .$_POST['email'] . "\n"; $message .= 'Interests: ' .$_POST['interests'] . "\n"; $message .= 'I am a: ' .$_POST['i_am_a'] . "\n"; mail($to, $subject, $message); header("Loacation: http://74.11.20.249/" .$goto_); } else if (isset($_POST['submit'])){ echo 'Please complete the required fields marked with an asterisk (*)'; echo '
'; } else { } ?>

All required fields are marked with an asterisk (*).

Name *

Email *


I am interested in accessing: * I am interested in... Information Fees Contracts & Disclosures Realtor Forms Lender Forms
I am a: * I am a... Buyer Seller Realtor Lender
[/php]

Any help would greatly be appreciated. I’ve been stuck on this issue for the past few days and would like to finish up the job for these people.

Sponsor our Newsletter | Privacy Policy | Terms of Service