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 8613681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:56:31+00:00 2026-06-12T04:56:31+00:00

I have something like that in my code: <?php foreach($clients as $client): ?> <tr

  • 0

I have something like that in my code:

<?php foreach($clients as $client): ?>
    <tr class="tableContent">
        <td onclick="location.href='<?php echo site_url('clients/edit/'.$client->id ) ?>'"><?php echo $client->id ?></td>
        <td>
            <a class='Right btn btn-danger' onClick="ConfirmMessage('client', <?php $client->id ?>,'clients')">
                <i class="icon-remove-sign icon-white"></i>
            </a>
        </td>
    </tr>
<?php endforeach  ?>

that’s actually the view. So when the user click on the delete button (thr one with the btn-danger class) I’d like him to confirm his choice with a javascript confirmation box message. You can find that script in the header

function ConfirmMessage(type, id, types) {
    if (confirm("Are you sure you want to delete this ",type," ?")) { // Clic sur OK
       document.location.href='<?php echo site_url(); ?>',types,'/delete/',id;
    }
}

So here is my question:

I would like the $type to be replaced by a paramenter (like client, article, post .. ) that I’ll pass to the function. And i would like to get the $client->id parameter as well.
I’m bad in javascript and as you already have guess, It is obviously not working at all.

  • 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-12T04:56:32+00:00Added an answer on June 12, 2026 at 4:56 am

    Concatenate strings in JavaScript with + (versus . in PHP):

    confirm("Are you sure you want to delete this " + type + " ?");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have something like this: <?php foreach($post_array as $post): ?> <div class=postBodyWrapper> <div
I have something like this in my code: worker.setObject(queue.poll()); I want a queue that
I have code that looks something like, #include<stdlib.h> #include<string.h> char** someArray = NULL; size_t
I have code that looks something like this in javascript: forloop { //async call,
I have a code that goes something like: $cipher_alg = MCRYPT_RIJNDAEL_128; $decrypted_string = mcrypt_decrypt($cipher_alg,
I have a code that looks something like: struct Data { int value; };
Basic question here - I have many lines of code that look something like:
In my code, I have something that looks like this: @implementation MyClass - (id)
I have some code in a couple of different functions that looks something like
I have a program that simulates mouse click. Code is something like this: [DllImport(user32.dll,

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.