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

  • SEARCH
  • Home
  • 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 7165017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:10:16+00:00 2026-05-28T14:10:16+00:00

Here’s what I got. <script type=text/javascript> function show_confirm(id) { var r=confirm(Are you sure you

  • 0

Here’s what I got.

<script type="text/javascript">
function show_confirm(id)
{
var r=confirm("Are you sure you want to duplicate this record?");
if (r==true)
  {
  window.open ("http://domain.com/process.php?duplicate=id","mywindow");
  }
else
  {
  alert("Record Not Duplicated.");
  }
}
</script>

then below that:

$query = "SELECT * FROM contacts";
        $result = mysql_query($query);      

        while($row = mysql_fetch_row($result)){

                $id = $row[0];
                $company = $row[3];
                $firstName = $row[4];
                $protection = $row[20];

            echo '<tr>';
            echo '<td width="120" align="middle"><font color="black"><b>' . $company . '</b></font></td>';
            echo '<td width="120" align="middle"><font color="black"><b>' . $firstName . '</b></font></td>';

            echo "<td width='120' align='middle'><a style='text-decoration: none;' href='http://domain.com/index.php?id=14&edit=" . $id . "'><span style='font-family:Helvetica; color:black;'>Edit</span></a>";
            echo "<td width='120' align='middle'><input type='button' onclick='show_confirm($id)' value='Duplicate' />";

            echo "</td>";               
            echo '</tr>';


        }
        ?>

The problem is this:

echo "<td width='120' align='middle'><input type='button' onclick='show_confirm($id)' value='Duplicate' />";

This is supposed to be a button where when the user clicks it, it says "are you sure you want to duplicate?" then if the use clicks yes, it to http://domain.com/process.php?duplicate=(whatever the ID is)

The problem is my variable (in php) $id, isn’t getting passed to the javascript window.open. I need the $id from the row to be passed along in the javascript. I tried writing it, but it didn’t work. Doesn’t even see the variable. I’ve tried manually entering in <?php echo $id; ?> and that didn’t work as well.

Thank you

  • 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-05-28T14:10:16+00:00Added an answer on May 28, 2026 at 2:10 pm

    In order to pass the id, you must use the variable:

    window.open ("http://domain.com/process.php?duplicate=" + id,"mywindow");
    

    (you put it in the string)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my problem I have this javascript if (exchRate != ) { function roundthecon()
Here my code: $(document).ready(function() { $('#mid_select').live('click', function(e){ $('#middle').load( $(this).attr('href') + ' #middle'); var page
here is javascript code: var test = { h : function (a) {return a;},
Here is an example. foreach (var doc in documents) { var processor = this.factory.Create();
Here is my javascript code for a cursor focus function to go to username
Here is what I want to do. Use this HTML line and have the
Here's a coding problem for those that like this kind of thing. Let's see
Here's my function: static Map AddFormation(Map _map, Tile tile, int x, int y, int
Here's my search array: $aExt = array('png','jpg','gif'); I want to search through the variable:
Here is my code...I have two dimensional matrices A,B. I want to develop the

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.