title: jquery js post variable set and get for post
body: <p>I need to send some parameters from a php page to another to post email dynamically,</p>
  
  <p>if I send the value as hardcoded is ok, but if i send the value on a textfield, it doesnt work,</p>
  
  <p>here the code</p>
  
  <p>page that request post of mail</p>
  
  <pre><code>&lt;script&gt;
  $otroYa = other.val();
  console.log (other.val()); //shows value ok of this var!
  $.post( "send-mail-parklane-suscrib.php" , {otro: "ss9", otro2: $otroYa });
  &lt;/script&gt;
  </code></pre>
  
  <p>so, </p>
  
  <blockquote>
    <p>otro2 = $otroYa</p>
  </blockquote>
  
  <p>doesnt get set? , but hardcoding otro, is ok</p>
  
  <p>php page called to perform post</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;&lt;title&gt;PHP Mail Sender&lt;/title&gt;&lt;/head&gt;
  &lt;body&gt;
  &lt;?php
  session_start(); 
  echo("chamb");
  $to = 'juanma@gmail.com';
  $from = 'bot@prklanefinancial.com.au';
  $subject = 'Prklane Financial Subscribe';
  $headers = 'From: bot@prklanefinancial.com.au' . "\r\n".
  'Reply-To: test@abc.com'. "\r\n".
  'Return-Path: test@abc.com' . "\r\n".
  'X-Mailer: PHP/' . phpversion();
  $message = "SS9 tkt ss9!!!";
  $name=$_POST['otro2'];  
  mail($to, $subject, $name, $headers, "-f $from");
  ?&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>so if I send my mail with the value </p>
  
  <blockquote>
    <p>$name=$_POST['otro2'];</p>
  </blockquote>
  
  <p>is empty</p>
  
  <p>but using the hardcoded</p>
  
  <blockquote>
    <p>$name=$_POST['otro'];</p>
  </blockquote>
  
  <p>is ok</p>
  
  <p>how to set the var? </p>
  
  <p>thanks!</p>