We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,240 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

function next page pass id

</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?

4
Contributors
3
Replies
1 Year
Discussion Span
1 Month Ago
Last Updated
9
Views
momonq1990
Light Poster
48 posts since Jul 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

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?

You can try this:

http://stackoverflow.com/questions/8680491/javascript-confirm-with-php-function-afterward

LastMitch
Industrious Poster
4,181 posts since Mar 2012
Reputation Points: 132
Solved Threads: 335
Skill Endorsements: 45

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')

});
imBaCodes
Junior Poster
168 posts since Apr 2013
Reputation Points: 2
Solved Threads: 18
Skill Endorsements: 9

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

masterjiraya
Posting Whiz
322 posts since Jul 2008
Reputation Points: 10
Solved Threads: 31
Skill Endorsements: 4

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0733 seconds using 2.78MB