Jump to content

Trouble with some form mailer script.


DonelleJenae

Recommended Posts

I have a real estate client that I have built a basic form mailer script in PHP for. His site contists of three pages with simple HTML, JavaScript, CSS, and PHP.

 

The site is a custom home search where users will submit a form that contains custom home search criteria. The agent then gets results to his email where he will use them to contact the user and email them etc...

 

The contact form works just fine for what I am using it for, however, there is a dropdown menu that lists cities for the user to select from. It is a list that allows for multiple selections using ctrl+click. When the user selects multiple cities, only the last city he or she selects comes through in the results. I have attached my PHP.

 

I have tried several options with adding code to the form that allows for multiple option selection, such as

 

$cities = implode(', ', $_POST['Cities']);

 

$city=$_POST['Cities'];

if($city)

{

foreach ($city as $cities){$citiesselected=$citiesselected.$cities.",";}

}

$aCities=$citiesselected;

 

and

 

 

var_export($_POST['formCities']);

 

 

 

My knowledge of PHP is very limited, I am self taught, and know very little. If someone could please tell me what I am doing wrong it would be greatly appreciated. I have tested all of the different strands of code on the server with either errors in return or it doesn't work how it should.

 

My HTML form code is as follows:

 

<form method="post" action='http://www.findourpad.com/contact.php'>

      <p align="right"> </p>

        <div class="aboutus"><a name="homesearch" id="homesearch"></a>DREAM HOME SEARCH</div>

        <hr align="left" width="413px" size="2px" bgcolor="#F1F1F1" noshade="noshade" />

        <p align="left">Residence Type:

          <select name="jumpMenu" id="jumpMenu" onchange="MM_jumpMenu('parent',this,0)">

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

            <option value="http://www.findourpad.com/condos.html#condosearch">Condo</option>

                              </select> 

         </p>

        <p align="left"><em>If selecting multiple cities, please press ctrl + click to select more than one option.</em><br />

          <select name="Cities" size="6" multiple="MULTIPLE" id="Cities">

            <option

selected="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>

          <br />

          <br />

              <br />

          Other Cities:

          <input name="Other Cities" type="text" id="Other Cities" maxlength="200" />

          <br />

          <br />

          Home Type:

          <select name="type" id="type">

            <option selected="selected">No Preference</option>

            <option>1 Story</option>

            <option>2 Story</option>

            <option>Tri-Level</option>

            <option>Split</option>

            <option>1 Story w/ Basement</option>

          </select>

        </p>

<p align="left">Min. Price: 

              <select name="Minimum Price" id="Minimum Price">

                <option selected="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>

           Max. Price: 

          <select name="Maximum Price" id="Maximum Price">

            <option selected="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 />

           

          <script type="text/javascript">

//set the size of the dropdown

function SetMDDsize(mddSize) {

  document.getElementById('MultDD').size = mddSize;

}

function GetMDDselections(mddSize) {

  var total = 0;

  for (i=0; i<document.getElementById('MultDD').options.length; i++) {

    if (document.getElementById('MultDD').options.selected == true)

    {

    total+=parseInt(document.getElementById('MultDD').options.value);

    document.getElementById('MultDD').options.selected = false;

    }

  }

  document.getElementById('MultDD').size = 1;

  document.getElementById('MultDD').selectedIndex = -1;

  return total;

}

      </script>

           <br />

          </span><span class="text">Min. Bedrms: 

          <select name="Mimimum Bedrooms" id="Mimimum Bedrooms">

            <option selected="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>

             Min. Bathrms

            <select name="Minimum Bathrooms" id="Minimum Bathrooms">

              <option selected="selected">No Preference</option>

              <option>1+</option>

              <option>2+</option>

              <option>3+</option>

              <option>4+</option>

              <option>5+</option>

          </select>

        </span></p>

<p align="left"><span class="text">Lot Size:

    <select name="Lot Size" id="Lot Size">

    <option selected="selected">No Preference</option>

    <option>1/3 acre or less</option>

    <option>1/2 acre or more</option>

    <option>1 acre or less</option>

    <option>1 acres +</option>

    <option>2 Acres -</option>

    <option>3 Acres +</option>

    <option>4 Acres +</option>

    <option>5 Acres +</option>

    <option>10 Acres +</option>

    <option>20 Acres +</option>

      </select>

  <br />

  </span><span class="text"> <br />

    Year Built:

    <select name="Year Built" id="Year Built">

      <option selected="selected">No Preference</option>

      <option>New Construction</option>

      <option>2000 and Newer</option>

      <option>1990 and Newer</option>

      <option>1980 and Newer</option>

      <option>Prior to 1980</option>

      </select>

     Square Ft:

    <select name="Square Feet" id="Square Feet">

      <option selected="selected">No Preference</option>

      <option>500+</option>

      <option>750+</option>

      <option>1000+</option>

      <option>1250+</option>

      <option>1500+</option>

      <option>1750+</option>

      <option>2000+</option>

      <option>2250+</option>

      <option>2500+</option>

      <option>2750+</option>

      <option>3000+</option>

      <option>3500+</option>

      <option>4000+</option>

      <option>4500+</option>

      <option>5000+</option>

      </select>

    <br />

    <br />

    Home Type: (Check boxes below) <br />

    Garage

    <input name="Garage" type="checkbox" id="Garage" value="checkbox" />

    <br />

    View

    <input name="View" type="checkbox" id="View" value="checkbox" />

    <br />

    Waterfront

    <input name="Waterfront" type="checkbox" id="Waterfront" value="checkbox" />

    <br />

    Golf Course

    <input name="Golf Course" type="checkbox" id="Golf Course" value="checkbox" />

    <br />

    Acrege

    <input name="Acerage" type="checkbox" id="Acerage" value="checkbox" />

    <br />

    New Construction

    <input name="New Construction" type="checkbox" id="New Construction" value="checkbox" />

    <br />

    <br />

    School District:</span>

  <input name="School District" type="text" id="School District" />

</p>

Additional Comments here:

            <textarea name="Comments" rows="2" id="Comments"></textarea>

            <br />

            <br />

            Name:

            <input name="Name" style="background-color: rgb(255, 255, 160);" type="text" id="Name" />

            <br />

            <br />

            <strong>Email Address:</strong> (required)

              <input name="Email" type="text" id="Email" style="background-color: rgb(255, 255, 160);" maxlength="75" />

              <input type='submit' value='Send' name="submit" onclick="MM_validateForm('Email','','RisEmail');return document.MM_returnValue" />

          <input type="hidden" name="op" value='send' />

            </span></p>

  </form>

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/197920-trouble-with-some-form-mailer-script/
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.