title: Calling a JavaScript function with argument from html form
body: <p>I am trying to pass an argument to a JavaScript function <code>getConfirmation()</code> and my code is as follows. The call to function is not executed at all. So I guess I am going wrong with calling it. Please help.</p>
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script type=&quot;text/javascript&quot;&gt;
  &lt;!--
  function getConfirmation(var value1)
  {
     
     var retVal = confirm(&quot;Pop Code:&quot; + value1 + &quot;\n&quot; + &quot;Amount:&quot; + &quot;&quot; + &quot;\n&quot; + &quot;Updated Balance:&quot; + &quot;&quot; + &quot;\nPlease confirm!&quot;);
     if( retVal == true )
     {
        alert(&quot;User wants to continue!&quot;);
        return true;
     }else{
        alert(&quot;User does not want to continue!&quot;);
        return false;
     }
  }
  //--&gt;
  &lt;/script&gt;
  &lt;body&gt;
  &lt;div align=&quot;center&quot; style=&quot;width:100%; margin: 0px auto;&quot;&gt;
  
  &lt;div align=&quot;center&quot; style=&quot;width:100%; margin: 0px auto; background-color:f0f0f0&quot;&gt;
  &lt;div id=&quot;child&quot; style=&quot;  align=&quot;center&quot; style=&quot;width:100%; margin:0px auto;&quot; &gt;
  &lt;div style=&quot; right:5%; top:5%; z-index: 100; position:absolute;&quot;&gt;
  
  &lt;/div&gt;
  &lt;img src = &quot;images/header.png&quot; width =&quot;100%&quot;  /&gt;
  
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;div align=&quot;center&quot;&gt;
  &lt;?php
  require 'config.php';
  mysql_connect ($dbhost, $dbusername, $dbuserpass);
  mysql_select_db($dbname) or die('Cannot select database');
  $query = &quot;SELECT * FROM cust_info;&quot;;
  $result = mysql_query($query) or die(mysql_error());
  
  echo &quot;&lt;/br&gt;&quot;;
  echo &quot;&lt;table border='1'&gt;
  &lt;tr&gt;
  &lt;th&gt;Pop Code&lt;/th&gt;
  &lt;th&gt;Open_Date&lt;/th&gt;
  &lt;th&gt;Maturity_Date&lt;/th&gt;
  &lt;th&gt;Amount&lt;/th&gt;
  &lt;th&gt;Balance&lt;/th&gt;
  &lt;th&gt;Col Amount&lt;/th&gt;
  &lt;/tr&gt;&quot;;
  
  while($row1 = mysql_fetch_array($result))
    {
    if ($row1['status'] == 'DONE')
    {
    continue;
    }
    echo &quot;&lt;div class=\&quot;addform\&quot;&gt;&lt;form method='post' action=\&quot;txn.php\&quot;&gt;\n&quot;;
    echo &quot;&lt;tr&gt;&quot;;
    echo &quot;&lt;td&gt;&lt;input type='hidden' name='pop_code' value='&quot;.$row1['pop_code'].&quot;'&gt;&quot; . $row1['pop_code'] . &quot;&lt;/td&gt;&quot;;
    echo &quot;&lt;td&gt;&lt;input type='hidden' name='open_date' value='&quot;.$row1['open_date'].&quot;'&gt;&quot; . $row1['open_date'] . &quot;&lt;/td&gt;&quot;;
    echo &quot;&lt;td&gt;&lt;input type='hidden' name='mat_date' value='&quot;.$row1['mat_date'].&quot;'&gt;&quot; . $row1['mat_date'] . &quot;&lt;/td&gt;&quot;;
    echo &quot;&lt;td&gt;&lt;input type='hidden' name='depoamt' value='&quot;.$row1['depoamt'].&quot;'&gt;&quot; . $row1['depoamt'] . &quot;&lt;/td&gt;&quot;;
    echo &quot;&lt;td&gt;&lt;input type='hidden' name='balance' value='&quot;.$row1['balance'].&quot;'&gt;&quot; . $row1['balance'] . &quot;&lt;/td&gt;&quot;;
    echo &quot;&lt;td&gt;&quot; . &quot;   &lt;input type=\&quot;text\&quot; name=\&quot;amount\&quot;/&gt;\n&quot; . &quot;&lt;/td&gt;&quot;;
    //echo &quot;&lt;td&gt;&quot; . &quot;&lt;input type=\&quot;button\&quot; value=\&quot;Make Entry\&quot; onclick=\&quot;getConfirmation();\&quot;&quot; . &quot;&lt;/td&gt;&quot;;
    echo &quot;&lt;td&gt;&quot; . &quot;   &lt;input type=\&quot;image\&quot; src=\&quot;images/update.png\&quot; onclick=\&quot;getConfirmation(&quot;.$row1['pop_code'].&quot;);\&quot; alt=\&quot;Update Row\&quot; class=\&quot;update\&quot; title=\&quot;Update Row\&quot;&gt;\n&quot; . &quot;&lt;/td&gt;&quot;;
    echo &quot;&lt;/tr&gt;&quot;;
    echo &quot;&lt;/form&gt;&lt;/div&gt;&quot;;
    }
  echo &quot;&lt;/table&gt;&quot;;
  ?&gt;
  &lt;div align=&quot;center&quot; style=&quot;width:100%; margin: 0px auto;&quot;&gt;
  &lt;img src=&quot;images/footer.png&quot; style=&quot;width:100%;&quot;/&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>