title: sending a value from drop down box to another page
body: <p>I have the following drop down box. I want to be able to select a value from this box and using Php sending it to another page. </p>
  
  <p>this is my current code for drop dwon box:</p>
  
  <p>version2:</p>
  
  <pre><code>&lt;form style="margin-top:20px; margin-right:+50px" name="formname" method="post" action="search.php"&gt;
  &lt;div class="controls controls-row"&gt;
  &lt;select name="select1" id="select1"&gt; 
  &lt;option value="SelectIsland"&gt;Select your island&lt;/option&gt;
  &lt;option value="stMaarten"&gt;St. Maarten&lt;/option&gt;
  &lt;option value="Aruba"&gt;Aruba&lt;/option&gt;
  &lt;option value="Curacou"&gt;Curacou&lt;/option&gt;
  &lt;option value="StBarths"&gt;St. Barths&lt;/option&gt;
  &lt;/select&gt;   
  
  &lt;select name="select2"&gt; 
  &lt;option value="SelectLoc"&gt;Select your location&lt;/option&gt;
  &lt;option value="Philipsburg"&gt;Philipsburg&lt;/option&gt;
  &lt;option value="SimpsonBay"&gt;Simpson Bay&lt;/option&gt;
  &lt;option value="Maho"&gt;Maho&lt;/option&gt;
  &lt;option value="Cupecoy"&gt;Cupecoy&lt;/option&gt;
  &lt;option value="Middleregion"&gt;Middle region&lt;/option&gt;
  &lt;option value="MadameEstate"&gt;Madame Estate&lt;/option&gt;
  &lt;option value="StPeters"&gt;St. Peters&lt;/option&gt;
  &lt;option value="DawnBeach"&gt;Dawn Beach&lt;/option&gt;
  &lt;/select&gt;
  &lt;input type="submit" name="button" class="btn btn-primary" value="Find Restaurant" style="margin-top:-10px; margin-right:0px" /&gt;
  &lt;/div&gt;
  &lt;?php 
  $select1 = $_POST['select1'];
  ?&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I am trying to pass $select1 to search.php, using this: $select1 = $_POST['select1'];</p>
  
  <p>however I get this following error, without doing anything:
   Notice: Undefined index: select1 in C:\wamp\www\iLandgrub.com V 1.2\main page\index.php on line 194, on y index.php.</p>
  
  <p>If I remove  $select1 = $_POST['select1']; then it will work but on search.php I dont get the values I wanted.</p>
  
  <p>this my code in search.php:</p>
  
  <p>the same applies for select2, as well. I am already in my index.php withut doing anything I get the error Undefined index.</p>
  
  <pre><code>&lt;?php
  if(isset($_POST['select1']) &amp;&amp; isset($_POST['select2'])) {
  $select1 = $_GET['select1'];
  $select2 = $_GET['select2'];
  echo $select1;
  echo "";
  echo $select2;
  }
  else{
  echo "not set";
  }
  ?&gt; 
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/BT4XV.jpg" alt="enter image description here">
  this is the error in index.php, when you go to this page.</p>