Javascript, or Jquery and posting to php
<p>I want to send a javascript variable to a php file. What I would like to know is could you do it via this method?</p>

<p>Jquery:</p>

<pre><code>Var UserName;
UserName = John;
$.post("InsertRunInfo.php", { UserName: UserName } );
</code></pre>

<p>Pass to php:</p>

<pre><code>&lt;?php
$con = mysql_connect("*****","*****","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("runtracker", $con);


$sql="INSERT INTO userinfo (UserName)
VALUES
('$_POST[UserName]')";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "1 record added";

mysql_close($con);
?&gt;
</code></pre>
