Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8511845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:07:11+00:00 2026-06-11T04:07:11+00:00

I am trying to pass an argument to a JavaScript function getConfirmation() and my

  • 0

I am trying to pass an argument to a JavaScript function getConfirmation() 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.

<html>
<head>
<script type="text/javascript">
<!--
function getConfirmation(var value1)
{
   
   var retVal = confirm("Pop Code:" + value1 + "\n" + "Amount:" + "" + "\n" + "Updated Balance:" + "" + "\nPlease confirm!");
   if( retVal == true )
   {
      alert("User wants to continue!");
      return true;
   }else{
      alert("User does not want to continue!");
      return false;
   }
}
//-->
</script>
<body>
<div align="center" style="width:100%; margin: 0px auto;">

<div align="center" style="width:100%; margin: 0px auto; background-color:f0f0f0">
<div id="child" style="  align="center" style="width:100%; margin:0px auto;" >
<div style=" right:5%; top:5%; z-index: 100; position:absolute;">

</div>
<img src = "images/header.png" width ="100%"  />

</div>
</div>
<div align="center">
<?php
require 'config.php';
mysql_connect ($dbhost, $dbusername, $dbuserpass);
mysql_select_db($dbname) or die('Cannot select database');
$query = "SELECT * FROM cust_info;";
$result = mysql_query($query) or die(mysql_error());

echo "</br>";
echo "<table border='1'>
<tr>
<th>Pop Code</th>
<th>Open_Date</th>
<th>Maturity_Date</th>
<th>Amount</th>
<th>Balance</th>
<th>Col Amount</th>
</tr>";

while($row1 = mysql_fetch_array($result))
  {
  if ($row1['status'] == 'DONE')
  {
  continue;
  }
  echo "<div class=\"addform\"><form method='post' action=\"txn.php\">\n";
  echo "<tr>";
  echo "<td><input type='hidden' name='pop_code' value='".$row1['pop_code']."'>" . $row1['pop_code'] . "</td>";
  echo "<td><input type='hidden' name='open_date' value='".$row1['open_date']."'>" . $row1['open_date'] . "</td>";
  echo "<td><input type='hidden' name='mat_date' value='".$row1['mat_date']."'>" . $row1['mat_date'] . "</td>";
  echo "<td><input type='hidden' name='depoamt' value='".$row1['depoamt']."'>" . $row1['depoamt'] . "</td>";
  echo "<td><input type='hidden' name='balance' value='".$row1['balance']."'>" . $row1['balance'] . "</td>";
  echo "<td>" . "   <input type=\"text\" name=\"amount\"/>\n" . "</td>";
  //echo "<td>" . "<input type=\"button\" value=\"Make Entry\" onclick=\"getConfirmation();\"" . "</td>";
  echo "<td>" . "   <input type=\"image\" src=\"images/update.png\" onclick=\"getConfirmation(".$row1['pop_code'].");\" alt=\"Update Row\" class=\"update\" title=\"Update Row\">\n" . "</td>";
  echo "</tr>";
  echo "</form></div>";
  }
echo "</table>";
?>
<div align="center" style="width:100%; margin: 0px auto;">
<img src="images/footer.png" style="width:100%;"/>
</div>
</div>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T04:07:12+00:00Added an answer on June 11, 2026 at 4:07 am

    It should be:

    function getConfirmation(value1){
    

    and form:

    echo "<div class=\"addform\"><form method='post' action=\"txn.php\" onsubmit=\"return getConfirmation('".$row1['pop_code']."');\">";
    

    and you can leave the submit image alone without any javascript calls.

    Final code:

      echo "<div class=\"addform\"><form method='post' action=\"txn.php\" onsubmit=\"return getConfirmation('".$row1['pop_code']."',this,'".$row1['balance']."');\">\n";
      echo "<tr>";
      echo "<td><input type='hidden' name='pop_code' value='".$row1['pop_code']."'>" . $row1['pop_code'] . "</td>";
      echo "<td><input type='hidden' name='open_date' value='".$row1['open_date']."'>" . $row1['open_date'] . "</td>";
      echo "<td><input type='hidden' name='mat_date' value='".$row1['mat_date']."'>" . $row1['mat_date'] . "</td>";
      echo "<td><input type='hidden' name='depoamt' value='".$row1['depoamt']."'>" . $row1['depoamt'] . "</td>";
      echo "<td><input type='hidden' name='balance' value='".$row1['balance']."'>" . $row1['balance'] . "</td>";
      echo "<td><input type=\"text\" name=\"amount\"/>\n</td>";
      echo "<td><input type=\"image\" src=\"images/update.png\" alt=\"Update Row\" class=\"update\" title=\"Update Row\">\n</td>";
      echo "</tr>";
      echo "</form></div>";
    

    and javascript:

    <script type="text/javascript">
    <!--
    function getConfirmation(value1,form,balance)
    {
    
       var retVal = confirm("Pop Code:" + value1 + "\n" + "Amount:" + form.amount.value + "\n" + "Updated Balance:" + balance + "\nPlease confirm!");
       if( retVal == true )
       {
          alert("User wants to continue!");
          return true;
       }else{
          alert("User does not want to continue!");
          return false;
       }
    }
    //-->
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to pass an optional argument to a javascript function from jQuery. In
I'm trying to pass a function as an argument and call that function within
Trying to pass a string argument to a function, which will then be used
I'm trying to pass a string argument to a target function in a process.
In this jsFiddle am I trying to pass an argument to a function, but
I'm trying to pass a c# variable as an argument to a java-script function
Am trying to pass a argument in jquery html pop up.But am not able
I'm trying to create a copy to clipboard IE javascript function but my code
I'm trying to pass a function reference from JavaScript in a WebView, so my
I am trying to pass two arguments in the on click javascript function. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.