title: How to pass a variable in form using GET with spaces in PHP+HTML+SQL
body: <p>I have a form where I display a select item and two other invisible inputs with some variable values that I need to pass to the same page at the press of the "Action" button. But I'm having the problem that those variables are city names like "New York", so there is a space inside the name, and at the moment of passing the variable only the "New" gets passed; nothing after the space goes with it. I have read that there shouldn't be any spaces in those variables, so how should I do this?</p>
  
  <p>Here is my sample code:</p>
  
  <pre><code>// at the beginning of the code I get this variables pass from other pages
  
  $pais=$_GET['pais']; 
  $name=$_GET['nombre'];
  
  
  // this is how I query my table to populate my select item
  
  $SN=mysql_real_escape_string($name);
  $SP=mysql_real_escape_string($pais);
  $estadoquery = "SELECT * FROM `".$SP."` ORDER BY Estado ASC";
  $estadoresult = mysql_query($estadoquery);
  
  
  // this is how I make my form
  
  &lt;form method="post" action="&lt;?php echo $_SERVER['PHP_SELF']?&gt;"&gt;
  &lt;input type="HIDDEN"  name=nombre  value="&lt;? echo $SN ?&gt;"&gt;
  &lt;input type="HIDDEN"  name=pais  value="&lt;? echo $SP ?&gt;"&gt;
    &lt;th scope="col" align="center" valign="baseline" size="18px"&gt;
  
        &lt;select name=estado  id="estado" style="font-size:24px"&gt;
         &lt;option value=""&gt;Todos&lt;/option&gt;
          &lt;?
          while($rowp = mysql_fetch_array($estadoresult)) {
                 $estado = $rowp['Estado'];
                 $Se=mysql_real_escape_string($estado);
            ?&gt;
          &lt;option value=&lt;?php echo $Se ?&gt;&gt;
          &lt;?php echo $Se ?&gt;&lt;/option&gt;
          &lt;? } ?&gt;
        &lt;/select&gt;
    &lt;/th&gt;
     &lt;th scope="col" align="center" valign="baseline"&gt; 
    &lt;input type="SUBMIT"  name="ACTION" value="IR"&gt;
  &lt;/th&gt;&lt;/form&gt;
  
  
  // and this is what the button action does
  
   if(@$_POST['ACTION']=='IR')
  {
  $pais = $_POST['pais'];
  $name = $_POST['nombre'];
  $estado = $_POST['estado'];
    $pais = mysql_escape_string($pais);
    $name = mysql_escape_string($name);
    $estado = mysql_escape_string($estado);
  // this next echos are just to check my variables.
  echo $pais;
  echo $name;
  echo $estado; // so here I can tell that this variable is not complete
  </code></pre>
  
  <p>}</p>
  
  <p>And I have read that variables cannot be passed with spaces, why does my <code>$pais</code> variable "United States" gets passed with the space in between correctly?
  Can someone tell me how to achieve this or how to transform my <code>&lt;option value=&lt;?php echo $Se ?&gt;&gt;</code> so it can pass the space? </p>