</head>

Code blocks are created by indenting at least 4 spaces
... and can span multiple lines

<body>

<script type="text/javascript">
function show_confirm($uid)
{
var r=confirm("Press a button!");
if (r==true)
  {
 <?php header(location: sample.php?id=$uid)?>
  }
else
  {
  alert("You pressed Cancel!");
  }
 }
</script>
</head>
 <body>

 <input type="button" onclick="show_confirm($uid)" value="delete command



" />

guy help me to this code.. a want to add javascript dialog box to my delete and then the function if yes it will submit the value of $uid to the next page to process the delete in php code. i want to know or any sample code there for passing id through function? and how?

Recommended Answers

All 3 Replies

Try These .. it may help you ..

<input type = button id = confirm />
<input type = button id = camcel />


$('#confirm').click(function(){

    //Store in u_ID the url of which page you want the user to redirect.
    Var u_ID = http://www.the_user_will_redirect_here.com;

     window.location.assign(u_ID)

});

$('#cancel').click(function(){

    alert('You pressed cancel')

});

you cannot use direct Java scripting use jQuery instead like imBaCodes has posted is a form of jQuery

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.