Page 1 of 1

confirm delete

Posted: Wed Aug 16, 2006 10:45 pm
by eektech909
I'm using a javascript to confirm a deletion when an image is pressed. I want the page to be redirected when you click OK at the confirm box. But the url has to include some variables from the php page like $name blah blah...
how can I include that into the javascript code when the javascript function is outside the php code?

Posted: Wed Aug 16, 2006 10:47 pm
by feyd
echo it into the Javascript code just like you would HTML.

Posted: Wed Aug 16, 2006 11:15 pm
by eektech909

Code: Select all

function codel() {
	var message = "Are you sure you want to delete this show?";
	var return_value = confirm(message);
	if (return_value == true) {
  window.location= "<?php echo ('del.php?thedate=' . ($row["DATE"]) . '&thevenue=' . htmlentities($row["VENUE"]) . ''); 
  ?>";
 		exit;
	} else {
		}
}
it redirected me to

del.php?thedate=&thevenue=

it didn't fill in the variables

Posted: Wed Aug 16, 2006 11:33 pm
by eektech909
got it!