Jump to content

Im new here, new to php and desperatly need some coding help


DonelleJenae

Recommended Posts

Ok...I just created my first php mail script. Basically, what I am trying to do is get this form on my page link>> http://www.findourpad.com/index.htm << work where a client can fill out the form, press submit, and the results will go to my email inbox. I also want the browser to go to a page that I have created called thanks.htm that will thank the user for submitting the home search info, I don't know why but after a lot of messing with this and time and effort on my part to  get it to work correctly, I test the form and press submit and it just says findourpad.com/sendmail.php in the address bar with a blank screen and nothing comes to my email inbox??? I am so confused.

 

I have coded my php (first time, with some help, I don't really know anything about it) and the file is named sendmail.php. I don't know if I have anyting wrong with this or not. Can someone please tell me if I coded this right, if my html code for my form is correct (ie...not missing anything to make the php work correctly). Please help? Let me know if you need any additional information.

 

Here is the php code >>

 

<?php

$property = $_POST['property'];

$cities = $_POST['cities'];

$other = $_POST['other'];

$min = $_POST['min'];

$max = $_POST['max'];

$rooms = $_POST['rooms'];

$bath = $_POST['bath'];

$amenities = $_POST['amenities'];

$email = $_POST['email'];

 

$to = "webbgrafix@hotmail.com";

$subject = ";Custom Home Search Results";

 

$eol="\r\n";

 

$headers = "From: ". $full_name ." <". $email .">".$eol;

$headers .= "Reply-To: ". $full_name." <". $email .">".$eol;

 

$message = ";Property Type: ". $property . "\n";

$message .= ";Cities: ". $cities ". "\n";

$message .= ";Other Locations: ". $other . "\n";

$message .= ";Minimum Price: ". $min . "\n";

$message .= ";Maximum Price: ". $max . "\n";

$message .= ";Minimum Bedrooms: ". $rooms . "\n";

$message .= ";Minimum Bathrooms: ". $bath . "\n";

$message .= ";Other Amenities: ". $amenities . "\n";

$message .= ";Email Address: ". $email . "\n";

 

mail("$to", "$subject", "$message", "$headers");

?>

 

This is the code from my form >>link to findourpad/index.htm (above)<<

<div id="search">

  <FORM ACTION="sendmail.php" FORM="submit" METHOD="post" name="homesearch" id="homesearch">

    <p align="right"><span class="text"><strong>Property Type</strong>: 

          <select name="property" id="property" onChange="MM_jumpMenu('parent',this,0)">

            <option value="http://www.findourpad.com/index.htm" selected>House</option>

            <option value="http://www.findourpad.com/condos.htm">Condo</option>

          </select>     

      <br>

      Cities: 

      <select name="cities" id="cities">

        <option selected>Bellevue</option>

        <option>Redmond</option>

        <option>Issaquah</option>

        <option>Kirkland</option>

        <option>Kenmore</option>

        <option>Bothell</option>

        <option>Preston</option>

        <option>Fall City</option>

        <option>Sammamish</option>

        <option>Snoqualmie</option>

      </select>

      Other: 

      <input name="other" type="text" id="other" maxlength="200">

      <br>

      <br>

      Minimum Price: 

      <select name="min" id="min">

        <option selected>100,000</option>

        <option>125,000</option>

        <option>150,000</option>

        <option>175,000</option>

        <option>200,000</option>

        <option>225,000</option>

        <option>250,000</option>

        <option>275,000</option>

        <option>300,000</option>

        <option>350,000</option>

        <option>400,000</option>

        <option>450,000</option>

        <option>500,000</option>

        <option>550,000</option>

        <option>600,000</option>

        <option>650,000</option>

        <option>700,000</option>

        <option>750,000</option>

        <option>800,000</option>

        <option>850,000</option>

        <option>900,000</option>

        <option>950,000</option>

        <option>1,000,000</option>

        <option>1,500,000</option>

        <option>2,000,000</option>

        <option>2,500,000</option>

        <option>3,000,000</option>

        <option>3,500,000</option>

        <option>4,000,000</option>

        <option>4,500,000</option>

        <option>5,000,000</option>

      </select>     

      <br>

      Maximum Price: 

      <select name="max" id="max">

        <option selected>100,000</option>

        <option>125,000</option>

        <option>150,000</option>

        <option>175,000</option>

        <option>200,000</option>

        <option>225,000</option>

        <option>250,000</option>

        <option>275,000</option>

        <option>300,000</option>

        <option>350,000</option>

        <option>400,000</option>

        <option>450,000</option>

        <option>500,000</option>

        <option>550,000</option>

        <option>600,000</option>

        <option>650,000</option>

        <option>700,000</option>

        <option>750,000</option>

        <option>800,000</option>

        <option>850,000</option>

        <option>900,000</option>

        <option>950,000</option>

        <option>1,000,000</option>

        <option>1,500,000</option>

        <option>2,000,000</option>

        <option>2,500,000</option>

        <option>3,000,000</option>

        <option>3,500,000</option>

        <option>4,000,000</option>

        <option>4,500,000</option>

        <option>5,000,000</option>

      </select>     

            <br>

      Minimum Bedrooms: 

      <select name="rooms" id="rooms">

        <option selected>no preference</option>

        <option>studio</option>

        <option>1+</option>

        <option>2+</option>

        <option>3+</option>

        <option>4+</option>

        <option>5+</option>

        <option>6+</option>

      </select>     

      <br>

      Minimum Bathrooms: 

      <select name="bath" id="bath">

        <option selected>no preference</option>

        <option>1+</option>

        <option>2+</option>

        <option>3+</option>

        <option>4+</option>

        <option>5+</option>

      </select>

      <br>

      <br>

      <strong>List home type, view type, lot type, lot size, and other desired amenities below</strong>:<br>

      <textarea name="amenities" id="amenities"></textarea>

      <br>

      Email Address</span><span class="style7">:</span><span class="style1">

      <input name="email" type="text" id="email" maxlength="75">

      <input type="submit" name="Submit" value="Submit">

    </span></p>

  </form>

</div>

 

Link to comment
Share on other sites

No, I can't get it to work, I need to know if I have coded it correctly. I need a visitor to the site to be able to fill out the form on the findourpad home page @ >>http://www.findourpad.com/index.htm<< and press submit and have the resuts come to my email inbox.

 

Right now, when I test the file it just opens up a blank screen and says http://www.findourpad.com/sendmail.php in the browser window, and I get nothing in my inbox. I need to know if I have my code right. I don't know a whole lot about php and this is my first time coding anything using it. I have tried everything to get it to work and am getting no where fast. I am lost...

 

Link to comment
Share on other sites

Because you did the quotes wrong

 

try this

 

<?php
$property = $_POST['property'];
$cities = $_POST['cities'];
$other = $_POST['other'];
$min = $_POST['min'];
$max = $_POST['max'];
$rooms = $_POST['rooms'];
$bath = $_POST['bath'];
$amenities = $_POST['amenities'];
$email = $_POST['email'];

$to = "webbgrafix@hotmail.com";
$subject = ";Custom Home Search Results";

$eol="\r\n"; 

$headers = "From: ". $full_name ." <". $email .">".$eol;
$headers .= "Reply-To: ". $full_name." <". $email .">".$eol;

$message = ";Property Type: ". $property . "\n";
$message .= ";=Cities: ". $cities."\n";
$message .= ";Other Locations: ". $other . "\n";
$message .= ";Minimum Price: ". $min . "\n";
$message .= ";Maximum Price: ". $max . "\n";
$message .= ";Minimum Bedrooms: ". $rooms . "\n";
$message .= ";Minimum Bathrooms: ". $bath . "\n";
$message .= ";Other Amenities: ". $amenities . "\n";
$message .= ";Email Address: ". $email . "\n";

mail("$to", "$subject", "$message", "$headers"); 
?>

This is the code from my form >>link to findourpad/index.htm (above)<<
<div id="search">
  <FORM ACTION="sendmail.php" FORM="submit" METHOD="post" name="homesearch" id="homesearch">
    <p align="right"><span class="text"><strong>Property Type</strong>: 
          <select name="property" id="property" onChange="MM_jumpMenu('parent',this,0)">
            <option value="http://www.findourpad.com/index.htm" selected>House</option>
            <option value="http://www.findourpad.com/condos.htm">Condo</option>
          </select>      
      

      Cities: 
      <select name="cities" id="cities">
        <option selected>Bellevue</option>
        <option>Redmond</option>
        <option>Issaquah</option>
        <option>Kirkland</option>
        <option>Kenmore</option>
        <option>Bothell</option>
        <option>Preston</option>
        <option>Fall City</option>
        <option>Sammamish</option>
        <option>Snoqualmie</option>
      </select>
      Other: 
      <input name="other" type="text" id="other" maxlength="200">
      

      

      Minimum Price: 
      <select name="min" id="min">
        <option selected>100,000</option>
        <option>125,000</option>
        <option>150,000</option>
        <option>175,000</option>
        <option>200,000</option>
        <option>225,000</option>
        <option>250,000</option>
        <option>275,000</option>
        <option>300,000</option>
        <option>350,000</option>
        <option>400,000</option>
        <option>450,000</option>
        <option>500,000</option>
        <option>550,000</option>
        <option>600,000</option>
        <option>650,000</option>
        <option>700,000</option>
        <option>750,000</option>
        <option>800,000</option>
        <option>850,000</option>
        <option>900,000</option>
        <option>950,000</option>
        <option>1,000,000</option>
        <option>1,500,000</option>
        <option>2,000,000</option>
        <option>2,500,000</option>
        <option>3,000,000</option>
        <option>3,500,000</option>
        <option>4,000,000</option>
        <option>4,500,000</option>
        <option>5,000,000</option>
      </select>      
      

      Maximum Price: 
      <select name="max" id="max">
        <option selected>100,000</option>
        <option>125,000</option>
        <option>150,000</option>
        <option>175,000</option>
        <option>200,000</option>
        <option>225,000</option>
        <option>250,000</option>
        <option>275,000</option>
        <option>300,000</option>
        <option>350,000</option>
        <option>400,000</option>
        <option>450,000</option>
        <option>500,000</option>
        <option>550,000</option>
        <option>600,000</option>
        <option>650,000</option>
        <option>700,000</option>
        <option>750,000</option>
        <option>800,000</option>
        <option>850,000</option>
        <option>900,000</option>
        <option>950,000</option>
        <option>1,000,000</option>
        <option>1,500,000</option>
        <option>2,000,000</option>
        <option>2,500,000</option>
        <option>3,000,000</option>
        <option>3,500,000</option>
        <option>4,000,000</option>
        <option>4,500,000</option>
        <option>5,000,000</option>
      </select>      
            

      Minimum Bedrooms: 
      <select name="rooms" id="rooms">
        <option selected>no preference</option>
        <option>studio</option>
        <option>1+</option>
        <option>2+</option>
        <option>3+</option>
        <option>4+</option>
        <option>5+</option>
        <option>6+</option>
      </select>      
      

      Minimum Bathrooms: 
      <select name="bath" id="bath">
        <option selected>no preference</option>
        <option>1+</option>
        <option>2+</option>
        <option>3+</option>
        <option>4+</option>
        <option>5+</option>
      </select>
      

      

      <strong>List home type, view type, lot type, lot size, and other desired amenities below</strong>:

      <textarea name="amenities" id="amenities"></textarea>
      

      Email Address</span><span class="style7">:</span><span class="style1">
      <input name="email" type="text" id="email" maxlength="75">
      <input type="submit" name="Submit" value="Submit">
    </span></p>
  </form>
</div>

Link to comment
Share on other sites

Thank you, I will try that, I am about to test it. Does it look like I have the html part of the page relating to my form correct? I am not sure if I have to put something on the variables in there to make the form work or not? I have this line in my form code <FORM ACTION="sendmail.php" FORM="submit" METHOD="post" name="homesearch" id="homesearch">

 

Link to comment
Share on other sites

so try:

 

<?php
$property = $_POST['property'];
$cities = $_POST['cities'];
$other = $_POST['other'];
$min = $_POST['min'];
$max = $_POST['max'];
$rooms = $_POST['rooms'];
$bath = $_POST['bath'];
$amenities = $_POST['amenities'];
$email = $_POST['email'];

$to = "webbgrafix@hotmail.com";
$subject = ";Custom Home Search Results";

$eol="\r\n"; 

$headers = "From: ". $full_name ." <". $email .">".$eol;
$headers .= "Reply-To: ". $full_name." <". $email .">".$eol;

$message = ";Property Type: ". $property . "\n";
$message .= ";=Cities: ". $cities."\n";
$message .= ";Other Locations: ". $other . "\n";
$message .= ";Minimum Price: ". $min . "\n";
$message .= ";Maximum Price: ". $max . "\n";
$message .= ";Minimum Bedrooms: ". $rooms . "\n";
$message .= ";Minimum Bathrooms: ". $bath . "\n";
$message .= ";Other Amenities: ". $amenities . "\n";
$message .= ";Email Address: ". $email . "\n";

if(mail("$to", "$subject", "$message", "$headers")){

echo "Mail Was Sent, Check Your Junk or Inbox.";

}else{

echo "There was an error delivering your message, please try again";


}
?>

Link to comment
Share on other sites

I don't understand, do you think this is a server problem? The client uses godaddy and he has a windows server. I don't know what to check this, I didn't install an email server. I have never done anything like this before. Just created HTML, javascript, and flash before, I have never had to use anything like this

Link to comment
Share on other sites

Ok, I just called godaddy and found out that one of my probs is that he is on a windows server, so I had to switch him over to a linux server. As you prob know and even I know (being a php newbie) PHP code wont work on a windows server.

 

So, it takes 24 hrs to move him over to the new server. I apparently, also have to connect my form script to thier form mailer code and change my form action code to <form action="/gdform.php" method="post">, add their script to my php code and change the web address in hosting control to mine temporarily to test my code.

 

So it looks like it will be at least tomorrow before I am able to wrap this up. Thanks for your help. I will let you know if it is resolved tomorrow or come back and post my new code for more help if I still cannot get this to work.

 

Thank you so much for all your help.

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.